public void Execute()
        {
            BackgroundModel background = backgroundCollection.Get(args.Value);

            string parentProfileNames = GetParentProfileNames(background);

            if (parentProfileNames != null)
            {
                MessageBoxView.Show("Can't delete this background", $"This background is used by one or more profiles ({parentProfileNames}), you can't delete it.");
                return;
            }

            backgroundCollection.Remove(background);

            if (screenModel.Background == background)
            {
                // Default background can't be deleted so there's always at least 1 item in the list.
                screenModel.SetBackground(backgroundCollection.Items[0]);
            }

            database.DeleteBackground(background);

            string dirPath = locationModel.GetGraphicBasePath(background.DirectoryType);

            File.Delete(Path.Combine(dirPath, background.FileName));
        }
Exemplo n.º 2
0
        private static Task <DialogResult> ShowCore(Window owner, string text, string caption, MessageBoxButtons buttons,
                                                    MessageBoxIcon icon,
                                                    MessageBoxDefaultButton defaultButton,
                                                    MessageBoxOptions options)
        {
            MessageBoxView window = new MessageBoxView(owner, options);

            window.DataContext = new MessageBoxViewModel(text, caption, buttons, window.GetIconDrawing(icon), defaultButton, options);
            return(owner != null?window.ShowDialog(owner) : window.Show());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Load event for MainFormView.
        /// </summary>
        /// <param name="sender">Object with send this event.</param>
        /// <param name="e">Event object.</param>
        private void MainFormView_Load(object sender, EventArgs e)
        {
            presenter = Bootstrapper.ServiceLocator.GetService <IMainFormViewPresenter>();

            Settings.Click += (x, y) =>
            {
                using (
                    SettingsView view = new SettingsView())
                {
                    view.ShowDialog();
                }
            };

            ShowInstruction.Click += (x, y) =>
            {
                Presenter.OpenInstruction();
            };

            About.Click += (x, y) =>
            {
                using (
                    AboutView view = new AboutView())
                {
                    view.ShowDialog();
                }
            };

            Close.Click += (x, y) =>
            {
                if (MessageBoxView.Show("Zamknąć aplikację? Wszystkie wykonane obliczenia zostaną utracone.", "Zamknij",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    this.Close();
                }
            };

            SetDefaulfAlgorithm();
            SetStartupValues();
            SetStartupControlsState();
            SetWeightsDataSource(null);
        }
 public void Show()
 {
     _messageBoxView.Show();
 }
Exemplo n.º 5
0
 public void NotifyAboutNotMarketAtLeastOneAttributeAsDecision()
 {
     MessageBoxView.Show("W systemie nie ustawiono ani jednego atrybutu decyzyjnego.",
                         "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 6
0
 public void NotifyAboutMissingDefaultPdfReader()
 {
     MessageBoxView.Show("W systemie nie zdefiniowano domyślnego programu do odczyty plików pdf.",
                         "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 7
0
 public void NotifyAboutZeroRulesInResponse()
 {
     MessageBoxView.Show("Dla wprowadzonych wartości parametrów algorytm nie zwrócił żadnego wyniku.",
                         "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 8
0
 public void NotifyAboutMissingInstruction()
 {
     MessageBoxView.Show("Plik z instrukcją nie został znaleziony.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }
Exemplo n.º 9
0
 public void NotifyAboutIncorrectArchive()
 {
     MessageBoxView.Show("Archiwum jest uszkodzone.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 10
0
 public void NotifyAboutIncorrectNumberOfFilesInArchive()
 {
     MessageBoxView.Show("Nieprawidłowa liczba plików w archiwum. Poprawny opis zawartości archiwum można znaleźć w instrukcji.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 11
0
 public void NotifyAboutRowsNotParsedCorrectly()
 {
     MessageBoxView.Show("Błąd przy parsowaniu wierszy z danymi. Poprawny format zapisu zbiorów danych dla poszczególnych formatów plików można znaleźć w instrukcji.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 12
0
 public void NotifyAboutNoPermissionsToFile()
 {
     MessageBoxView.Show("Brak uprawnień do pliku lub jest on obecnie wykorzystywany przez inny proces.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 13
0
 public void NotifyAboutArgumentCountIncorrect()
 {
     MessageBoxView.Show("Liczba atrybutów w poszczególnych wierszach musi być identyczna.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Exemplo n.º 14
0
 public void NotifyAboutUnsupportedFileSelected()
 {
     MessageBoxView.Show("Załadowny format pliku nie jest obsługiwany. Listę wspieranych formatów można znaleźć w instrukcji obsługi.",
                         "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }