Inheritance: System.Windows.Forms.Form
		private static void Main(string[] args)
		{
			Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
			Application.ThreadException += Application_ThreadException;
			AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

			var current = Process.GetCurrentProcess();
			if (args.Length > 0 && args[0].Contains("-kill"))
			{
				var instances = Process.GetProcessesByName("TPTray");
				instances.Where(process => process.Id != current.Id).ToList().ForEach(p => p.Kill());				
			}
			else if (FindWindow(null, "TP.Tray") == 0)
			{
				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);
				Application.VisualStyleState = VisualStyleState.ClientAndNonClientAreasEnabled;
				
				var retriever = new AssignmentRetreiver();
				var asm = new AssignmentsManager(SettingsManager.FirstTimeRunning);
				
				if (SettingsManager.FirstTimeRunning)
				{
					SettingsManager.FirstTimeRunning = false;
					SettingsManager.HotKeyEnabled = true;
				}
				
				Application.Run(FormsManager.GetInstance<TPEMain>());
			}
		}
		public AssignmentRetreiver()
		{
			if (instance != null)
				return;
			instance = this;

			backgroundWorker = new BackgroundWorker();
			backgroundWorker.DoWork += backgroundWorker_DoWork;
			backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;


			timer = new Timer();
			timer.Tick += TimerMethod;
			timer.Interval = 100;
			timer.Start();
		}
Exemple #3
0
        public AssignmentRetreiver()
        {
            if (instance != null)
            {
                return;
            }
            instance = this;

            backgroundWorker                     = new BackgroundWorker();
            backgroundWorker.DoWork             += backgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;


            timer          = new Timer();
            timer.Tick    += TimerMethod;
            timer.Interval = 100;
            timer.Start();
        }