예제 #1
0
        /// <summary>
        /// 打开设置页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void linkSetting_Click(object sender, EventArgs e)
        {
            var         settingBackUp = _settingInfo.DeepCopy();
            SettingForm settingForm   = new SettingForm(_settingInfo);

            settingForm.Activate();
            var dlgRes = settingForm.ShowDialog();

            if (dlgRes != DialogResult.OK)
            {
                _settingInfo = settingBackUp;
            }

            if (_settingInfo == null)
            {
                _settingInfo = new MSettingInfo();
            }
            this.metroStyleManager1.Theme = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            if (_settingInfo.MetroColorStyle < 0 || _settingInfo.MetroColorStyle >= 15)
            {
                _settingInfo.MetroColorStyle = MetroColorStyle.Blue.GetHashCode();
            }
            this.metroStyleManager1.Style = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.StyleManager             = this.metroStyleManager1;
            this.deployStep.StyleManager  = this.metroStyleManager1;
            this.linkSetting.Style        = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.linkSetting.Theme        = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.buildProgressBar.Style   = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.buildProgressBar.Theme   = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.metroToolTip1.Style      = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.metroToolTip1.Theme      = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.metroCbDeployType.Style  = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.metroCbDeployType.Theme  = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.Refresh();
        }
예제 #2
0
        private void DeployForm_Shown(object sender, EventArgs e)
        {
            _settingInfo = SettingHelper.LoadSettingInfo();
            if (_settingInfo?.GetCurrServiceInfo() == null)
            {
                var         settingBackUp = _settingInfo.DeepCopy();
                SettingForm settingForm   = new SettingForm(_settingInfo);
                settingForm.Activate();
                var dlgRes = settingForm.ShowDialog();
                if (dlgRes != DialogResult.OK)
                {
                    _settingInfo = settingBackUp;
                }
            }

            if (_settingInfo == null)
            {
                _settingInfo = new MSettingInfo()
                {
                    SelectedItems = new List <MSelectedItem>(), ServiceInfos = new List <ServiceInfo>()
                };
            }
            this.metroStyleManager1.Theme = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            if (_settingInfo.MetroColorStyle < 0 || _settingInfo.MetroColorStyle >= 15)
            {
                _settingInfo.MetroColorStyle = MetroColorStyle.Blue.GetHashCode();
            }
            this.metroStyleManager1.Style = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.StyleManager             = this.metroStyleManager1;
            this.deployStep.StyleManager  = this.metroStyleManager1;
            this.linkSetting.Style        = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.linkSetting.Theme        = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.buildProgressBar.Style   = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.buildProgressBar.Theme   = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.metroToolTip1.Style      = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.metroToolTip1.Theme      = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.metroCbDeployType.Style  = (MetroColorStyle)_settingInfo.MetroColorStyle;
            this.metroCbDeployType.Theme  = _settingInfo.MetroThemeStyle <= 1 ? MetroThemeStyle.Light : MetroThemeStyle.Dark;
            this.Refresh();


            // 尝试连接服务器
            var isConnect = ApiHelper.Connect(_settingInfo);

            if (!isConnect)
            {
                MetroMessageBox.Show(this, "默认服务器连接失败,请检查服务器地址或者选择其他服务器进行部署", "无法连接到服务器", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            SetStepIndex(1);
        }