Пример #1
0
        private void btnClearLog_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBoxMgr.CreateNewResult("Are you sure you want to clear the error log?", "Clear Error Log?", MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                eLog.ClearErrorLog();
                textRange.Text = "There are currently no entries.";
            }
        }
Пример #2
0
        private void wndEdit_Closed(object sender, CancelEventArgs e)
        {
            MessageBoxResult result = MessageBoxMgr.CreateNewResult("You will lose any unsaved changes. Proceed?", "Warning", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                UpdateSelectedFiles();
            }
            else
            {
                e.Cancel = true;
            }
        }
Пример #3
0
        private void btnCommit_Click(object sender, RoutedEventArgs e)
        {
            if (dgInfoBox.ItemsSource.Cast <Media>().Where(x => x.isChecked == true).ToList().Count > 0)
            {
                MessageBoxResult messageBoxCommit = MessageBoxMgr.CreateNewResult("Are you sure you want to save these changes? This cannot be undone.", "Edit Confirmation", MessageBoxButton.YesNo);

                if (messageBoxCommit == MessageBoxResult.Yes)
                {
                    bool        completedWithoutErrors = true;
                    List <bool> listCompletion         = new List <bool>();

                    BackgroundWorker worker = new BackgroundWorker();

                    worker.DoWork += (o, ea) =>
                    {
                        foreach (Media item in dgInfoBox.Items)
                        {
                            if (item.isChecked)
                            {
                                completedWithoutErrors = Media.WriteToShellFile(item);
                                listCompletion.Add(completedWithoutErrors);
                            }
                        }
                    };

                    worker.RunWorkerCompleted += (o, ea) =>
                    {
                        //work has completed. you can now interact with the UI
                        if (listCompletion.Contains(false))
                        {
                            MessageBoxMgr.CompleteMessage(false);
                        }
                        else
                        {
                            MessageBoxMgr.CompleteMessage(true);
                        }

                        biIsWorking.IsBusy = false;
                    };

                    biIsWorking.IsBusy = true;
                    worker.RunWorkerAsync();
                }
            }
            else
            {
                MessageBoxMgr.ItemsRequiredMessage();
            }
        }
Пример #4
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            EditWindow editWindow = new EditWindow();

            //I had this setup as enabled/disabled with a listview, but a datagrid wants to be a pain, so this will work for now.
            if (dgInfoBox.ItemsSource.Cast <Media>().Where(x => x.isChecked == true).ToList().Count > 0)
            {
                editWindow.ShowDialog();
                dgInfoBox.Items.Refresh();
            }
            else
            {
                MessageBoxMgr.ItemsRequiredMessage();
            }
        }