示例#1
0
文件: Context.cs 项目: chzh/xrefresh
        public Context()
        {
            Current = this;
            Utils.CheckOrGenerateUniqueId();

            refreshCounter = Utils.GetRefreshCounter();
            mainThreadID = Thread.CurrentThread.GetHashCode();

            memTimer.Interval = 1000; // execute after one second
            memTimer.Elapsed += new System.Timers.ElapsedEventHandler(memTimer_Elapsed);

            counterTimer.Interval = 5*60*1000; // execute every 5 minutes
            counterTimer.Elapsed += new System.Timers.ElapsedEventHandler(counterTimer_Elapsed);

            LoadSettings();
            model.Init();

            menu = new Menu();
            sysTray = new SysTray("", icon, menu);
            notifyIcon = sysTray.m_notifyIcon;
            notifyIcon.DoubleClick += new EventHandler(notifyIcon_DoubleClick);

            server = new Server();
            server.Start();

            menu.RebuildMenu();
            UpdateTrayIcon();

            worker = new Worker();
            model.Start();

            ThreadExit += new EventHandler(OnThreadExit);
            memTimer.Start();

            if (Utils.IsRunningFirstTime())
            {
                // open help page
                try
                {
                    Process.Start(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\Help.html");
                }
                catch (Exception)
                {
                    // opening help file was not so important ...
                }
                if (MessageBox.Show("XRefresh is running for the first time.\nDo you want to configure it now? [recommended]\n\nNote:\nYou can do it anytime later. Just right click on XRefresh icon in the traybar and select 'Configuration' from context menu.", "XRefresh Configuration during first start", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ShowConfiguration(this, new EventArgs());
                }
            }
        }
示例#2
0
文件: Server.cs 项目: chzh/xrefresh
 public Server()
 {
     Current = this;
 }
示例#3
0
文件: Server.cs 项目: chzh/xrefresh
 public ClientInfo(int id, Socket socket, Server parent)
 {
     this.id = id;
     this.socket = socket;
     this.parent = parent;
     this.muted = false;
     this.page = "";
     this.agent = "";
     this.type = "";
 }