public void SetEvents()
        {
            m_form.TrayIcon.DoubleClick += delegate
            {
                m_mainForm.ShowHide();
            };

            Application.ApplicationExit += delegate
            {
                if (Minder.Static.StaticData.Settings.Sync.Enable)
                {
                    //					using(new WaitingForm2("Syncing tasks...", "Minder. Please wait", false))
                    //					{
                    m_syncController.Sync();
                    Info infoSync = InfoFinder.FindByUniqueCode(Minder.Static.StaticData.InfoUniqueCodes.InfoLastSyncDate);
                    infoSync.Value1 = Minder.Static.StaticData.Settings.Sync.LastSyncDate.ToString();
                    GenericDbHelper.UpdateAndFlush(infoSync);


                    //					}
                }
            };

            m_syncController.Synced += delegate
            {
                //				m_form.TrayIcon.BalloonTipIcon = ToolTipIcon.Info;
                //				m_form.TrayIcon.BalloonTipTitle = "Minder synced!";
                //				m_form.TrayIcon.BalloonTipText = String.Format("Added {0} new task(s)!", m_syncController.NewTasks);
                //				m_form.TrayIcon.ShowBalloonTip(5);
                m_syncController.NewTasks = 0;
            };

            m_form.TrayIcon.BalloonTipClicked += delegate
            {
                new TasksFormController().PrepareWindow();
            };

            m_form.TrayIcon.MouseMove += delegate
            {
                m_form.TrayIcon.Text = FormatNextTaskRemindingDate();
            };
            m_mainForm.MTextBox.TextChanged += ParseRealTimeAndDisplay;
            m_mainForm.MWindow.Deactivated  += delegate { m_mainForm.MWindow.Hide(); };
        }
Exemple #2
0
        private static void Starter(string[] args)
        {
            ConfigLoader.Load();
            string log4netConfigPath = new PathCutHelper()
                                       .CutExecutableFileFromPath(System.Reflection.Assembly
                                                                  .GetExecutingAssembly().Location);

            log4netConfigPath += @"\Minder.log4net.xml";
            FileInfo config = new FileInfo(log4netConfigPath);

            log4net.Config.XmlConfigurator.Configure(config);
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(BootStrap));

            bool openForm = false;

            if (args != null)
            {
                foreach (string arg in args)
                {
                    if (arg.ToLower().Equals("--openform"))
                    {
                        openForm = true;
                    }
                }
            }

            SettingsLoader loader = new SettingsLoader();

            loader.LoadSettings();
            Minder.Static.StaticData.Settings.LogFilePath = @"Log\Minder.log";

            UpdateDBVersion();
            Info syncInfo = InfoFinder.FindByUniqueCode(Minder.Static.StaticData.InfoUniqueCodes.InfoLastSyncDate);

            if (syncInfo != null)
            {
                Minder.Static.StaticData.Settings.Sync.LastSyncDate = Convert.ToDateTime(syncInfo.Value1);
            }

            new StartWithWinController().StartWithWindows();
            //if(Minder.Static.StaticData.Settings.CheckUpdates)
            //	new UpdateProject(StaticData.VersionCache.Version, true, "Minder");

            MainFormPreparer preparer = new MainFormPreparer();

            if (openForm)
            {
                preparer.PrepareForm(openForm);
            }
            else
            {
                preparer.PrepareForm();
            }

            MousePositionHelper mouseMoveChecker = new MousePositionHelper();

            mouseMoveChecker.SartMouseMoveChecker();

            TimeController timeController = new TimeController(preparer);

            timeController.Start();

            logger.Info("Minder started");
        }