Ejemplo n.º 1
0
        private void AddServerSettings_Load(object sender, System.EventArgs e)
        {
            ServerConfig conf = UIConfigFileHandler.Instance().Config;

            IpFld.Text      = conf.Broadcast[0].Ip;
            PortFld.Text    = conf.Broadcast[0].Port.ToString();
            TimeoutFld.Text = conf.Broadcast[0].Timeout.ToString();
        }
        public static UIConfigFileHandler Instance()
        {
            if (instance == null)
            {
                instance = new UIConfigFileHandler();
            }

            return(instance);
        }
Ejemplo n.º 3
0
        private void Save()
        {
            ServerConfig conf = UIConfigFileHandler.Instance().Config;

            conf.Broadcast[0].Ip      = IpFld.Text;
            conf.Broadcast[0].Port    = Convert.ToInt32(PortFld.Text);
            conf.Broadcast[0].Timeout = Convert.ToInt32(TimeoutFld.Text);
            UIConfigFileHandler.Instance().Save();  // todo might need fix
        }
Ejemplo n.º 4
0
        public void RefreshView(bool initialize)
        {
            try
            {
                if (currentConnection == null)
                {
                    return;
                }

                if (!currentConnection.Connected)
                {
                    return;
                }

                refreshTimer.Enabled = false;

                sessionGrid.SuspendLayout();

                sessionTable.Clear();
                sessionTable.Merge(currentConnection.GetSessionList());

                ServerConfigRefreshRate r = UIConfigFileHandler.Instance().Config.RefreshRate;

                switch (r)
                {
                case ServerConfigRefreshRate.High:
                    refreshTimer.Interval = 1000;
                    refreshTimer.Enabled  = true;
                    break;

                case ServerConfigRefreshRate.Low:
                    refreshTimer.Interval = 30000;
                    refreshTimer.Enabled  = true;
                    break;

                case ServerConfigRefreshRate.Normal:
                    refreshTimer.Interval = 10000;
                    refreshTimer.Enabled  = true;
                    break;

                case ServerConfigRefreshRate.Paused:
                    refreshTimer.Enabled = false;
                    break;
                }
            }
            catch (Exception ex)
            {
                currentConnection.Disconnect();
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sessionGrid.ResumeLayout(true);
            }
        }
 private UIConfigFileHandler(string fileName)
 {
     activeConfigFileName = fileName;
     this.Load();
     instance = this;
 }