Exemplo n.º 1
0
Arquivo: FrmOpen.cs Projeto: xqgzh/Z
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtRemoteAddress.Text))
                {
                    DialogResult = DialogResult.Cancel;
                    return;
                }

                RemoteConfigObj = Activator.GetObject(typeof(Z.C.RemoteConfig), GetRemoteAddress()) as RemoteConfig;

                //检查是否能够正常使用
                RemoteConfigObj.GetConfig(txtRemoteName.Text, txtRemotePass.Text);

                if (txtRemoteAddress.SelectedItem is ConfigFileEntity)
                {

                }
                else
                {
                    //检查是否有重复的, 如果是重复的, 则重新赋值
                    ConfigFileEntity cfe = ManagerConfig.Instance.Find(txtRemoteAddress.Text);

                    if (cfe != null)
                    {
                        cfe.RemotePass = txtRemotePass.Text;
                        cfe.RemoteFile = txtRemoteFile.Text;
                    }
                    else
                    {
                        cfe = new ConfigFileEntity();

                        cfe.RemoteAddress = GetRemoteAddress();
                        cfe.RemotePass = txtRemotePass.Text;
                        cfe.RemoteFile = txtRemoteFile.Text;
                        cfe.RemoteName = txtRemoteName.Text;

                        ManagerConfig.Instance.List.Add(cfe);
                        ManagerConfig.Instance.List.Sort();
                    }
                    ManagerConfig.Save();
                }

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        public ConfigNode(ConfigFileEntity config)
        {
            ImageIndex = 2;

            Text = config.Name;

            if (string.IsNullOrEmpty(Text))
            {
                UriBuilder u = new UriBuilder(config.RemoteAddress);

                Text = string.Format("{0}[{1}]", u.Host, config.RemoteName);
            }
            SelectedConfig = config;
        }
Exemplo n.º 3
0
        public ConfigNode(ConfigFileEntity config)
        {
            ImageIndex = 2;

            Text = config.Name;

            if (string.IsNullOrEmpty(Text))
            {
                UriBuilder u = new UriBuilder(config.RemoteAddress);

                Text = string.Format("{0}[{1}]", u.Host, config.RemoteName);
            }
            SelectedConfig = config;
        }
Exemplo n.º 4
0
        public ConfigMenu(ConfigFileEntity config) : base(config.Name)
        {
            base.AutoSize = true;
            Text          = config.Name;

            if (string.IsNullOrEmpty(Text))
            {
                UriBuilder u = new UriBuilder(config.RemoteAddress);

                Text = string.Format("{0}[{1}]", u.Host, config.RemoteName);
            }

            SelectedConfig = config;
            DisplayStyle   = ToolStripItemDisplayStyle.Text;

            base.Width = 200;
        }
Exemplo n.º 5
0
        public ConfigMenu(ConfigFileEntity config)
            : base(config.Name)
        {
            base.AutoSize = true;
            Text = config.Name;

            if (string.IsNullOrEmpty(Text))
            {
                UriBuilder u = new UriBuilder(config.RemoteAddress);

                Text = string.Format("{0}[{1}]", u.Host, config.RemoteName);
            }

            SelectedConfig = config;
            DisplayStyle = ToolStripItemDisplayStyle.Text;

            base.Width = 200;
        }