Advertisement
KotyaraLast

Untitled

Jun 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using System.Windows.Forms;
  8.  
  9.  
  10. namespace timer
  11. {
  12.     class Program
  13.     {
  14.         static Planner planner;
  15.         static void Main(string[] args)
  16.         {
  17.             planner = Planner.Initializations();
  18.             planner.AddNews();
  19.             Console.ReadLine();
  20.         }
  21.     }
  22. }
  23.     class Planner
  24.     {
  25.         protected Planner() { }
  26.         private static Planner _planner;
  27.         private List<System.Windows.Forms.Timer> _timer = new List<System.Windows.Forms.Timer>();
  28.         private Thread thread;
  29.         //private ConsoleColor _color = ConsoleColor.Magenta;
  30.         public static Planner Initializations()
  31.         {
  32.             if (_planner != null)
  33.                 return _planner;
  34.             else
  35.             {
  36.                 _planner = new Planner();
  37.                 return _planner;
  38.             }
  39.  
  40.         }
  41.         public void Run()
  42.         {
  43.  
  44.         }
  45.         public void Cloce()
  46.         {
  47.  
  48.         }
  49.         public void ShowList()
  50.         {
  51.  
  52.         }
  53.         public void AddNews(/*DateTime time, string link, params int[] array*/)
  54.         {
  55.             int _second = /*(int)((long)time.Ticks - (long)DateTime.Now.Ticks) / 100000;*/  5000;
  56.             var timer = new System.Windows.Forms.Timer();
  57.             timer.Tick += Timer_Tick;
  58.             timer.Interval = _second;
  59.             timer.Enabled = true;
  60.             Application.DoEvents();
  61.             timer.Start();
  62.             _timer.Add(timer);
  63.         }
  64.  
  65.         private void Timer_Tick(object sender, EventArgs e)
  66.         {
  67.             Console.Beep();
  68.             Console.WriteLine("hello world");
  69.         }
  70.  
  71.         public void DeleteNews(int index)
  72.         {
  73.  
  74.         }
  75.         public void ReplaceTime(int index, DateTime _news)
  76.         {
  77.  
  78.         }
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement