Exemplo n.º 1
0
        /// <summary>
        /// Generate the form, load configs, show initial settings if needed.
        /// </summary>
        /// <param name="configs">Strings passed on the commandline</param>
        public FrmGlobalStatus(string[] commands)
        {
            InitializeComponent();
            this.niIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.niIcon_MouseClick);

            Helper.UpdateSettings();

            // if this is the first start: show settings
            if (Properties.Settings.Default.firstStart)
            {
                Properties.Settings.Default.firstStart = false;
                Properties.Settings.Default.Save();
                ShowSettings(true);
            }

            InitializeTrayIcon(ref trayDisconnectedIcon, "Disconnected.ico", Properties.Resources.TRAY_Disconnected);
            InitializeTrayIcon(ref trayConnectingIcon, "Connecting.ico", Properties.Resources.TRAY_Connecting);
            InitializeTrayIcon(ref trayConnectedIcon, "Connected.ico", Properties.Resources.TRAY_Connected);
            InitializeTrayIcon(ref trayMultipleIcon, "Multiple.ico", Properties.Resources.TRAY_Multiple);

            ReadConfigs();
            SetTrayIconAndPopupText();

            bool     checkupdate = false;
            TimeSpan ts          = Properties.Settings.Default.lastUpdateCheck
                                   - DateTime.Now;

            if (Properties.Settings.Default.searchUpdate == 0 ||
                (ts.Days > 7 && Properties.Settings.Default.searchUpdate == 1) ||
                (ts.Days > 30 && Properties.Settings.Default.searchUpdate == 2))
            {
                checkupdate = true;
                Properties.Settings.Default.lastUpdateCheck = DateTime.Now;
                Properties.Settings.Default.Save();
            }

            if (checkupdate)
            {
                Update u = new Update(true, this);
                if (u.checkUpdate())
                {
                    niIcon.ShowBalloonTip(5000,
                                          Program.res.GetString("QUICKINFO_Update"),
                                          Program.res.GetString("QUICKINFO_Update_More"),
                                          ToolTipIcon.Info);
                }
            }

            m_simpleComm.ReceivedLines += new
                                          EventHandler <SimpleComm.ReceivedLinesEventArgs>(
                m_simpleComm_ReceivedLines);

            parseCommandLine(commands);

            if (Properties.Settings.Default.allowRemoteControl)
            {
                m_simpleComm.startServer();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generate the form, load configs, show initial settings if needed.
        /// </summary>
        /// <param name="configs">Strings passed on the commandline</param>
        public FrmGlobalStatus(string[] commands)
        {
            InitializeComponent();
            helper.UpdateSettings();

            // if this is the first start: show settings
            if (Properties.Settings.Default.firstStart)
            {
                Properties.Settings.Default.firstStart = false;
                Properties.Settings.Default.Save();
                ShowSettings(true);
            }

            ReadConfigs();

            niIcon.Icon = Properties.Resources.TRAY_Disconnected;

            bool checkupdate = false;
            TimeSpan ts = Properties.Settings.Default.lastUpdateCheck
                - DateTime.Now;

            if (Properties.Settings.Default.searchUpdate == 0 ||
               (ts.Days > 7 && Properties.Settings.Default.searchUpdate == 1) ||
               (ts.Days > 30 && Properties.Settings.Default.searchUpdate == 2))
            {
                checkupdate = true;
                Properties.Settings.Default.lastUpdateCheck = DateTime.Now;
                Properties.Settings.Default.Save();
            }

            if (checkupdate)
            {
                Update u = new Update(true, this);
                if (u.checkUpdate())
                {
                    niIcon.ShowBalloonTip(5000,
                        Program.res.GetString("QUICKINFO_Update"),
                        Program.res.GetString("QUICKINFO_Update_More"),
                        ToolTipIcon.Info);
                }
            }

            m_simpleComm.ReceivedLines += new 
                EventHandler<SimpleComm.ReceivedLinesEventArgs>(
                m_simpleComm_ReceivedLines);

            parseCommandLine(commands);

            if(Properties.Settings.Default.allowRemoteControl)
                m_simpleComm.startServer();
        }