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();
        }
Ejemplo n.º 2
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
        }
        public static UIConfigFileHandler Instance()
        {
            if (instance == null)
            {
                instance = new UIConfigFileHandler();
            }

            return(instance);
        }
Ejemplo n.º 4
0
        public void RefreshView(bool initialize)
        {
            try
            {
                if (currentConnection == null)
                {
                    return;
                }

                if (!currentConnection.Connected)
                {
                    return;
                }

                RefreshTimer.Enabled = false;
                String  s  = currentConnection.Ps();
                DataSet ds = JobRuntimeDS.Clone();
                ds.Clear();
                ds.ReadXml(new StringReader(s), XmlReadMode.Auto);

                JobGrid.SuspendLayout();

                if (initialize)
                {
                    JobRuntimeDS.Clear();
                }

                JobRuntimeDS.Merge(ds.Tables["JobRuntimeType"]);

                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
            {
                JobGrid.ResumeLayout(true);
            }
        }
 private UIConfigFileHandler(String fileName)
 {
     activeConfigFileName = fileName;
     this.Load();
     instance = this;
 }