Exemplo n.º 1
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();
                var projInfo = ThreadHelper.JoinableTaskFactory.Run(GetSelectedProjInfoAsync);
                if (projInfo == null)
                {
                    throw new Exception("您还未选中项目");
                }

                if (projInfo.Kind != "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}")
                {
                    throw new Exception("当前插件仅支持C#程序");
                }

                var projModel = projInfo.AnalysisProject();
                if (projModel == null)
                {
                    throw new Exception("项目信息解析失败");
                }

                OptionPageGrid settingInfo = PublishService.GetSettingPage();
                if (string.IsNullOrWhiteSpace(settingInfo?.IpAdress))
                {
                    throw new Exception("请先完善设置信息");
                }

                // 尝试连接服务器
                //var isConnected = PublishService.CheckConnection();
                //if (!isConnected)
                //{
                //    throw new Exception("尝试连接服务器失败");
                //}

                //var publishForm = new PublishForm();
                //publishForm.Show();
                //publishForm.Ini(projModel);

                var form   = new DeployForm();
                var iniRes = form.Ini(projModel);
                if (iniRes.IsSucceed)
                {
                    form.Show();
                }
                else
                {
                    MessageBox.Show(iniRes.Message);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Exemplo n.º 2
0
        private void btnDeploy_Click(object sender, EventArgs e)
        {
            DeployForm deployForm = new DeployForm();

            deployForm.Show();
        }