예제 #1
0
        private void btnShowMsi_Click(object sender, EventArgs e)
        {
            string msiFile = null;

            if (rbtnAdapter.Checked)
            {
                return;
            }

            msiFile = GetMsiFilePath();
            if (null == msiFile)
            {
                btnInstall.Enabled = false;
                btnRemove.Enabled  = false;
                btnStop.Enabled    = false;
                btnStart.Enabled   = false;
                btnRecycle.Enabled = false;
                txtMsiPath.Clear();
                txtMsiFileName.Clear();
                return;
            }

            LoadingBox frm = new LoadingBox(msiFile);

            frm.Show(this);
            Application.DoEvents();
            frmInstalledPackages form = new frmInstalledPackages(msiFile);

            frm.Close();
            form.ShowDialog(this);
        }
예제 #2
0
        private async void button4_Click(object sender, EventArgs e)
        {// 下一个配方按钮
            if (checkRecipeSelected())
            {
                loadingBox.Show();
                loadingBox.Update();

                var selectedItem = getSelectedRecipes() as ListBoxItemInfo;

                bool isWithinErrorThreshold = await Task.Run(() =>
                {
                    for (int i = 0; i < 10; i++) // 多次采样验证
                    {
                        Thread.Sleep(200);
                        double cha = selectedItem.CurrentQuality
                                     - selectedItem.StandardQuality;
                        if (Math.Abs(cha) > Settings.ErrorThreshold)
                        {
                            return(false);
                        }
                    }
                    return(true);
                });

                loadingBox.Hide();

                if (isWithinErrorThreshold)
                {
                    if (!checkLastRecipeSelected())
                    {
                        listBox1.SelectedIndex += 1;
                    }
                }
                else
                {
                    MessageBox.Show("当前值不够稳定,未满足误差要求");
                }
            }
        }