Esempio n. 1
0
        private void BtnLoadSqlServerTables_Click()
        {
            WaitDialog wd = null;

            try
            {
                wd = new WaitDialog();
                wd.Show();//not modal
            }
            catch
            {
                MessageBox.Show("Please restart the about window!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                wd.Close();
            }

            try
            {
                IDataService  controller = new DataService();
                List <string> tables     = controller.GetSqlServerTables(this.FormData.SqlServer, this.FormData.ServerInstance, this.FormData.ServerDatenbank,
                                                                         this.FormData.ServerVersion, this.FormData.ServerUser, this.FormData.ServerPasswort);
                this.FormData.Tables = tables;
                FormData.Table       = tables.FirstOrDefault();
            }
            catch (Exception ex)
            {
                MessageBox.Show("The legend table wasn't defined or the session has been canceled! " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                //this.staLblMessage.Content = "The legend table wasn't defined or the session has been canceled!";
            }

            wd.Close();
        }
Esempio n. 2
0
        private void ProcessMultipleApps(string action)
        {
            AppListView.cancelProcessMultipleApps = false;

            // copy selection to an array
            Node[] array = this.SelectedNodes.ToArray();

            WaitDialog waitDialog = new WaitDialog();

            waitDialog.Title      = "Processing multiple applications";
            waitDialog.StatusText = "Please wait while your request is performed.";
            waitDialog.Name       = waitDialog.Title;
            waitDialog.CanCancel  = true;
            waitDialog.TotalWork  = this.SelectedNodes.Count;
            waitDialog.Cancel    += new EventHandler(this.WaitCancelHandler);
            ThreadPool.QueueUserWorkItem(new WaitCallback(AppListView.WaitCallbackProcessApps), new ProcessAppsData()
            {
                Action        = action,
                SelectedNodes = array,
                WaitDialog    = waitDialog,
                SnapIn        = this.SnapIn
            });

            waitDialog.ShowDialog();
            if (action == "PurgeCache")
            {
                return;
            }

            this.RefreshApps();
        }
Esempio n. 3
0
        private void httpResponse(JSONObject response)
        {
            WaitDialog.close();
            int error_code = response.getInt("error_code");

            if (error_code == 0)
            {
                resultList.Clear();
                FloderUtils floder = new FloderUtils(this.outPath);
                ArrayList   pathes = floder.listAllOrder();
                resultList = pathes;
                JSONArray list = response.getJSONArray("list");
                for (int i = 0; i < list.Count; i++)
                {
                    JSONObject item = list.getJSONObject(i);
                    resultList.Add(item);
                }
                reloadList();
            }
            else
            {
                string message = response.getString("message");
                MessageBox.Show(message);
            }
        }
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            AddSupplierView form = AddSupplierView.Instance;

            form.Text       = "Add Supplier";
            form.TextButton = "Add";
            form.Supplier   = null;
            Supplier supplier = form.Supplier;

            if (AddSupplierView.btnAddClicked && form.TextButton != "Save" && supplier != null)
            {
                var cus = from c in context.Suppliers
                          orderby c.Id descending
                          select c.Id;
                int count = cus.Count();
                if (count == 0)
                {
                    supplier.Id = "SP" + 1.ToString("D6");
                }
                else
                {
                    supplier.Id = "SP" + (Int32.Parse(cus.First().Split('P')[1]) + 1).ToString("D6");
                }
                context.Suppliers.Add(supplier);
                context.SaveChanges();
                using WaitDialog fr = new WaitDialog(AssignDataToDataGrid);
                fr.ShowDialog();
            }
        }
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            var addStaffView = AddStaffView.Instance;

            addStaffView.Text = "Add Staff";
            var staff = addStaffView.Staff;

            if (staff != null)
            {
                if (AddStaffView.AddClicked)
                {
                    var st = from c in context.Staffs
                             orderby c.Id descending
                             select c.Id;
                    int count = st.Count();
                    if (count == 0)
                    {
                        staff.Id = "ST" + 1.ToString("D6");
                    }
                    else
                    {
                        staff.Id = "ST" + (Int32.Parse(st.First().Split('T')[1]) + 1).ToString("D6");
                    }
                    context.Staffs.Add(staff);
                    context.SaveChanges();
                    MessageBox.Show("Added");
                    using WaitDialog fr = new WaitDialog(AssignDataToDataGrid);
                    fr.ShowDialog();
                }
            }
        }
Esempio n. 6
0
        public void ExportThread()
        {
            WaitDialog zWait = WaitDialog.Instance;

            for (int nIdx = ExportLayoutStartIndex; nIdx < ExportLayoutEndIndex; nIdx++)
            {
                IssueManager.Instance.FireChangeCardInfoEvent(nIdx, 1);
                IssueManager.Instance.FireChangeElementEvent(string.Empty);
                ChangeExportLayoutIndex(nIdx);
                zWait.ProgressReset(1, 0, CurrentDeck.CardCount, 0);

                UpdateBufferBitmap(CurrentDeck.CardLayout.width, CurrentDeck.CardLayout.height);
                var zGraphics = Graphics.FromImage(m_zExportCardBuffer);

                for (var nCardIdx = 0; nCardIdx < CurrentDeck.CardCount; nCardIdx++)
                {
                    IssueManager.Instance.FireChangeCardInfoEvent(nIdx, nCardIdx + 1);
                    CurrentDeck.CardPrintIndex = nCardIdx;
                    CardRenderer.DrawPrintLineToGraphics(zGraphics);
                    zWait.ProgressStep(1);
                }
                zWait.ProgressStep(0);
            }
            zWait.ThreadSuccess = true;
            zWait.CloseWaitDialog();
        }
Esempio n. 7
0
        private void OpenAndLoadXlsFile()
        {
            string          path = "";
            ConvertXlsToCsv conv = new ConvertXlsToCsv("ulaznih");

            conv.OpenXlsFile(ref path);
            if (path == "")
            {
                return;
            }
            //internal method used to pass params to method used as argument in WaitDialog constr.
            void act()
            {
                conv.SaveToCsvAndLoad(ref path);
                _listaStavki = File.ReadAllLines(path).Skip(3).Select(v => new KnjigaUra().FromCsv(v)).ToList();
            }

            using (WaitDialog waitDialog = new WaitDialog(act, SplashMessages.Učitavanje))
            {
                waitDialog.ShowDialog(this);
            }

            var data = new BindingSource
            {
                DataSource = _listaStavki
            };

            dbDdataGridView1.DataSource = data;
        }
Esempio n. 8
0
 public static void PostTask(this Form form, Action <IWaitDialog> action)
 {
     if (action == null)
     {
         return;
     }
     using (WaitDialog dlg = new WaitDialog()){
         dlg.Closing += delegate(object sender, CancelEventArgs e) {
             if (!dlg.CanClose)
             {
                 form.Info(R.TipStopTask);
                 e.Cancel = true;
             }
         };
         dlg.Shown += delegate {
             Thread thread = new Thread(() =>
             {
                 action(dlg);
                 dlg.CanClose = true;
                 dlg.CloseDialog();
             });
             thread.IsBackground = true;
             thread.Start();
         };
         dlg.ShowDialog();
     }
 }
Esempio n. 9
0
 private void Initilize()
 {
     context = new ApplicationContext();
     productView.BtnVewCategory += BtnVewCategory_Click;
     using WaitDialog fr         = new WaitDialog(AssignDataToDataGrid);
     fr.ShowDialog();
 }
Esempio n. 10
0
        static void RunTranslationTarget(
            BuildAction buildAction,
            EnvDTE.Project project,
            IEnumerable <string> selectedFiles = null)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            using (WaitDialog.Start(
                       "Qt Visual Studio Tools", "Running translation tool...")) {
                var qtPro = QtProject.Create(project);
                if (project == null || qtPro == null)
                {
                    Messages.Print(
                        "translation: Error accessing project interface");
                    return;
                }

                if (qtPro.FormatVersion < Resources.qtMinFormatVersion_Settings)
                {
                    Messages.Print("translation: Legacy project format");
                    try {
                        Legacy_RunTranslation(buildAction, qtPro, selectedFiles);
                    } catch (Exception e) {
                        Messages.Print(
                            e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
                    }
                    return;
                }

                var activeConfig = project.ConfigurationManager?.ActiveConfiguration;
                if (activeConfig == null)
                {
                    Messages.Print(
                        "translation: Error accessing build interface");
                    return;
                }
                var activeConfigId = string.Format("{0}|{1}",
                                                   activeConfig.ConfigurationName, activeConfig.PlatformName);

                var target     = "QtTranslation";
                var properties = new Dictionary <string, string>();
                switch (buildAction)
                {
                case BuildAction.Update:
                    properties["QtTranslationForceUpdate"] = "true";
                    break;

                case BuildAction.Release:
                    properties["QtTranslationForceRelease"] = "true";
                    break;
                }
                if (selectedFiles != null)
                {
                    properties["SelectedFiles"] = string.Join(";", selectedFiles);
                }

                QtProjectBuild.StartBuild(
                    project, project.FullName, activeConfigId, properties, new[] { target });
            }
        }
Esempio n. 11
0
        public void Execute()
        {
            if (CodeToExcute == null)
            {
                return;
            }

            defaultSplashScreen = new WaitDialog()
            {
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner
            };
            CodeToExcute.progressDisplayHelper = defaultSplashScreen;
            var task = new Task(() =>
            {
                var res = CodeToExcute.Execute();
                closeSplash();
                if (AsyncCallBack != null)
                {
                    AsyncCallBack(res);
                }
            });

            task.Start();
            defaultSplashScreen.ShowDialog();
        }
Esempio n. 12
0
        private void btnCompareToBaseLine_Click(object sender, EventArgs e)
        {
            if (_baseLineResults.StatsId == _results.StatsId)
            {
                MessageBox.Show("You are trying to compare the same statistics to itself. Please run another query to compare to.");
                return;
            }

            try
            {
                Action action = () =>
                {
                    string fileName         = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetTempFileName()) + ".html");
                    var    comparisonReport = GenerateComparisonReport();
                    File.WriteAllText(fileName, comparisonReport);
                    Process.Start(fileName);
                };

                WaitDialog.ShowDialog(this, () => action(), "Generate Report", "Generating comparison report ...", null);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Exception generating report: {ex.Message}");
            }
        }
Esempio n. 13
0
        private void buttonQuery_Click(object sender, EventArgs e)
        {
            this.buttonQuery.Enabled = false;

            WaitDialog waitDialog = new WaitDialog("Loading", string.Empty, new Size(260, 70), this.AppForm());

            try
            {
                this.InitQueryOption();

                string dataType  = this.dataSelectRadioGroup.Properties.Items[this.dataSelectRadioGroup.SelectedIndex].Description;
                string timeUnit  = this.timeUnitComboBox.Text;
                string queryType = string.Format("{0} ({1})", dataType, timeUnit);

                waitDialog.SetCaption("Loading data...");
                var dataList = this.GetDataList(queryType);

                waitDialog.SetCaption(string.Format("Writing data... ({0} items)", dataList.Count()));
                this.SetMainView(dataList, queryType);
            }
            finally
            {
                if (waitDialog != null)
                {
                    waitDialog.Close(this);
                }
                waitDialog = null;

                this.buttonQuery.Enabled = true;
            }
        }
Esempio n. 14
0
        private void httpResponse(JSONObject response)
        {
            WaitDialog.close();
            int error_code = response.getInt("error_code");

            if (error_code == 0)
            {
                FloderUtils folder      = new FloderUtils(outPath);
                JSONObject  value       = response.getJSONObject("value");
                string      file_path   = folder.createDeviceFolder(value.getString("deviceAddress"), orderID);
                BrainChart  brainCharts = new BrainChart(file_path, true, false, null);
                //brainCharts.Location = new Point(350, 45);
                //brainCharts.TopLevel = false;
                //this.Controls.Add(brainCharts);
                brainCharts.Show();
                brainCharts.Location = new Point(0, 0);
                resultList.Clear();
                JSONArray list = response.getJSONArray("list");
                for (int i = 0; i < list.Count; i++)
                {
                    JSONObject item = list.getJSONObject(i);
                    resultList.Add(item);
                }
                reloadList();
                setValue(value);
            }
            else
            {
                string message = response.getString("message");
                MessageBox.Show(message);
            }
        }
Esempio n. 15
0
        public void ShowWaitDialog(JobDescription jobDescription, CancellationTokenSource cts)
        {
            Debug.Assert(!this.Invoker.InvokeRequired, "ShowWaitDialog must be called on UI thread");

            this.waitDialog = new WaitDialog(jobDescription.StatusMessage, cts);
            this.waitDialog.ShowDialog(this);
        }
Esempio n. 16
0
 public CategoryView(Persistence.ApplicationContext context)
 {
     InitializeComponent();
     this.context            = context;
     using WaitDialog dialog = new WaitDialog(load);
     dialog.ShowDialog();
 }
Esempio n. 17
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            addCustomerView            = AddCustomerView.Instance;
            addCustomerView.Text       = "Add Customer";
            addCustomerView.TextButton = "Add";
            var data = addCustomerView.data;

            if (AddCustomerView._addClicked && addCustomerView.TextButton != "Save" && data != null)
            {
                var cus = from c in context.Customers
                          orderby c.Id descending
                          select c.Id;
                int count = cus.Count();
                if (count == 0)
                {
                    data.Id = "CUS" + 1.ToString("D6");
                }
                else
                {
                    data.Id = "CUS" + (Int32.Parse(cus.First().Split('S')[1]) + 1).ToString("D6");
                }
                context.Customers.Add(data);
                context.SaveChanges();
                using WaitDialog fr = new WaitDialog(AssignDataToDataGrid);
                fr.ShowDialog();
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 调用服务在服务端升级数据库。
        /// </summary>
        /// <param name="options"></param>
        private static void MigrateOnServer(MigratingOptions options)
        {
            var win = new WaitDialog();

            win.Width           = 500;
            win.IsIndeterminate = true;
            win.ShowInTaskbar   = false;
            win.Text            = "正在服务端执行数据库升级操作,请稍等……";

            Exception exception = null;

            ThreadPool.QueueUserWorkItem(oo =>
            {
                try
                {
                    var svc     = ServiceFactory.Create <MigrateService>();
                    svc.Options = options;
                    svc.Invoke();
                }
                catch (Exception ex)
                {
                    exception = ex;
                }

                Action ac = () => win.DialogResult = true;
                win.Dispatcher.BeginInvoke(ac);
            });

            win.ShowDialog();

            if (exception != null)
            {
                throw new Rafy.DbMigration.DbMigrationException("数据库升级时出错,请查看 InnerException。", exception);
            }
        }
Esempio n. 19
0
 public HomePresenter(IHomeView view)
 {
     this.view      = view;
     view.presenter = this;
     Initialize();
     using WaitDialog waitDialog = new WaitDialog(AssignDashboard);
     waitDialog.ShowDialog();
 }
        /// <summary>
        /// Shows a progress dialog while the login operation completes, then closes it when login is finished.
        /// </summary>
        private static async Task ShowWait(string provider)
        {
            var wait = new WaitDialog("Logging in with " + provider);

            UserLoggedIn += (s, e) => wait.Hide();
            AuthError    += (s, e) => wait.Hide();
            await DispatchHelper.RunAsync(async() => await wait.ShowAsync());
        }
Esempio n. 21
0
 private void ButtonSpremi_Click(object sender, EventArgs e)
 {
     using (WaitDialog waitDialog = new WaitDialog(SaveDataToDatabase, SplashMessages.Spremanje))
     {
         waitDialog.ShowDialog(this);
     }
     LoadDatagrid();
 }
Esempio n. 22
0
 /// <summary>
 /// Updates the list of available projects
 /// </summary>
 private void UpdateProjects()
 {
     if (Directory.Exists(txtFolder.Text))
     {
         var zWait = new WaitDialog(0, UpdateThread, "Scanning Directory", new string[] { string.Empty }, 300);
         zWait.ShowDialog(this);
     }
 }
Esempio n. 23
0
        private void btnSaveToZip_Click(object sender, EventArgs e)
        {
            if (_results == null)
            {
                MessageBox.Show("There are no query results to save.");
                return;
            }

            try
            {
                saveFileDialog1.DefaultExt      = ".zip";
                saveFileDialog1.Filter          = "Zip File|*.zip";
                saveFileDialog1.FileName        = "Save Query Stats";
                saveFileDialog1.OverwritePrompt = true;

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Action action = () =>
                    {
                        var fileName = saveFileDialog1.FileName;
                        if (File.Exists(fileName))
                        {
                            File.Delete(fileName);
                        }
                        var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
                        if (Directory.Exists(dir))
                        {
                            Directory.Delete(dir, true);
                        }
                        Directory.CreateDirectory(dir);

                        if (_baseLineResults != null && _baseLineResults.StatsId != _results.StatsId)
                        {
                            File.WriteAllText(Path.Combine(dir, "baseline.sql"), _baseLineResults.query_text);
                            File.WriteAllText(Path.Combine(dir, "baselineStats.rpt"), _baseLineResults.statistics);
                            File.WriteAllText(Path.Combine(dir, "baselineStats.sqlplan"), _baseLineResults.execution_plan);
                            File.WriteAllText(Path.Combine(dir, "ComparisonReport.html"), GenerateComparisonReport());
                            SaveStatisticsReport(Path.Combine(dir, "baselineStats.csv"), _baseLineResults);
                        }

                        File.WriteAllText(Path.Combine(dir, "query.sql"), _results.query_text);
                        File.WriteAllText(Path.Combine(dir, "queryStats.rpt"), _results.statistics);
                        File.WriteAllText(Path.Combine(dir, "queryStats.sqlplan"), _results.execution_plan);
                        SaveStatisticsReport(Path.Combine(dir, "queryStats.csv"), _results);

                        ZipFile.CreateFromDirectory(dir, fileName);

                        Directory.Delete(dir, true);
                    };

                    WaitDialog.ShowDialog(this, () => action(), "Save To Zip", "Saving statistics to zip ...", null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Exception saving file: {ex.Message}");
            }
        }
Esempio n. 24
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int row = Int32.Parse(dgvCategory.SelectedRows[0].Cells[0].Value.ToString());

            context.Categories.Where(c => c.Id == row).Delete();
            MessageBox.Show("deleted");
            using WaitDialog dialog = new WaitDialog(load);
            dialog.ShowDialog();
        }
Esempio n. 25
0
 private void ButtonBrisiRed_Click(object sender, EventArgs e)
 {
     using (WaitDialog waitDialog = new WaitDialog(DeleteSelectedRows, SplashMessages.Brisanje))
     {
         waitDialog.ShowDialog(this);
     }
     LoadDataView();
     LoadVrstaTemeljniceCombo();
 }
Esempio n. 26
0
        public virtual bool OpenTuner()
        {
            /* display the wait message */
#if false
            WaitDialog waitDlg = new WaitDialog();
            waitDlg.Show();
            waitDlg.Refresh();
#endif


            try
            {
            }
            catch (BadImageFormatException e)
            {
                ErrorMessage = "Unsupported architecture.";


                base.Close();
                return(false);
            }
            catch (Exception e)
            {
                ErrorMessage = "Unhandled exception." + Environment.NewLine + e;

                base.Close();
                return(false);
            }
            ErrorMessage = "";

            SelectFiles(true);

            Connected = true;


            /* close wait dialog and show ours */
#if false
            waitDlg.Close();
#endif

            Show();

            radioAcqOff.Checked = true;
            radioTuner.Checked  = true;
            radioAgcOff.Checked = true;
            chkAtt.Checked      = false;
            chkPreAmp.Checked   = false;

            radioTuner_CheckedChanged(null, null);
            chkAtt_CheckedChanged(null, null);
            chkPreAmp_CheckedChanged(null, null);
            radioAgcOff_CheckedChanged(null, null);

            radioAcqBlock.Checked = true;

            return(true);
        }
Esempio n. 27
0
        public void ExecuteModalBackgroundTask()
        {
            _dialog = new WaitDialog(Window.GetWindow(_parent));
            _dialog.IsCancellable = false;
            var task = Worker(new CancellationToken());

            _dialog.ShowDialog();
            _dialog = null;
        }
Esempio n. 28
0
 internal Natvis(DebuggedProcess process)
 {
     _typeVisualizers   = new List <FileInfo>();
     _process           = process;
     _vizCache          = new Dictionary <string, VisualizerInfo>();
     WaitDialog         = new WaitDialog(ResourceStrings.VisualizingExpressionMessage, ResourceStrings.VisualizingExpressionCaption);
     ShowDisplayStrings = DisplayStringsState.ForVisualizedItems;  // don't compute display strings unless explicitly requested
     _depth             = 0;
     Cache = new VisualizationCache();
 }
Esempio n. 29
0
        internal RefactoringOperationBase(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
            _waitDialog      = new WaitDialog(serviceProvider, OperationNameDescription, cancelable: true);

            IsCancelled       = false;
            ErrorOccurred     = false;
            _hasPreviewWindow = true;
            FileChanges       = new List <FileChange>();
        }
Esempio n. 30
0
 internal Natvis(DebuggedProcess process)
 {
     _typeVisualizers = new List<FileInfo>();
     _process = process;
     _vizCache = new Dictionary<string, VisualizerInfo>();
     WaitDialog = new WaitDialog(ResourceStrings.VisualizingExpressionMessage, ResourceStrings.VisualizingExpressionCaption);
     ShowDisplayStrings = DisplayStringsState.ForVisualizedItems;  // don't compute display strings unless explicitly requested
     _depth = 0;
     Cache = new VisualizationCache();
 }
Esempio n. 31
0
        public void ExecuteCancellableBackgroundTask()
        {
            _dialog         = new WaitDialog(Window.GetWindow(_parent));
            _cancel         = new CancellationTokenSource();
            _dialog.Closed += _dialog_Closed;
            var task = Worker(_cancel.Token);

            _dialog.ShowDialog();
            _dialog = null;
        }
Esempio n. 32
0
		public virtual int CreateInstance(out IVsThreadedWaitDialog2 ppIVsThreadedWaitDialog) {
			ppIVsThreadedWaitDialog = new WaitDialog();
			return 0;
		}