Пример #1
0
        private void ReturnFromArchive(Note note)
        {
            var confirmationViewSettings = new ModalWindowSettings
            {
                Title      = LanguageDictionary.GetValue("Confirmation"),
                ResizeMode = ResizeMode.NoResize
            };
            var confirmationView = ControlsCreator.GetSimpleTextView("UnarchiveNoteConfirmation", confirmationViewSettings);

            var result = ModalWindowPresenter.ShowModalOkCancel(confirmationView);

            if (result != true)
            {
                return;
            }
            try
            {
                // ReSharper disable once PossibleNullReferenceException
                note.IsArchived = false;
                NoteRepozitory.Update(note);
                FetchDataFromDatabase();
            }
            catch (Exception e)
            {
                ModalWindowPresenter.ShowErrorMessage("UnarchiveNoteException", e);
            }
        }
Пример #2
0
 private static void SetWindowSettings(Window wnd, ModalWindowSettings settings)
 {
     if (settings.MinHeight != 0)
     {
         wnd.MinHeight = settings.MinHeight;
     }
     if (settings.MinWidth != 0)
     {
         wnd.MinWidth = settings.MinWidth;
     }
     if (settings.MaxHeight != 0)
     {
         wnd.MaxHeight = settings.MaxHeight;
     }
     if (settings.MaxWidth != 0)
     {
         wnd.MaxWidth = settings.MaxWidth;
     }
     wnd.ResizeMode            = settings.ResizeMode;
     wnd.WindowStartupLocation = settings.StartupLocation;
     wnd.Title         = settings.Title;
     wnd.SizeToContent = settings.SizeToContent;
     if (settings.Icon != null)
     {
         wnd.Icon = settings.Icon;
     }
 }
Пример #3
0
        private void DeleteNoteExecute(object obj)
        {
            var confirmationViewSettings = new ModalWindowSettings
            {
                Title      = LanguageDictionary.GetValue("Confirmation"),
                ResizeMode = ResizeMode.NoResize
            };
            var confirmationView = ControlsCreator.GetSimpleTextView("DeleteNoteConfirmation", confirmationViewSettings);

            var result = ModalWindowPresenter.ShowModalOkCancel(confirmationView);

            if (result != true)
            {
                return;
            }
            var note = obj as Note;

            try
            {
                // ReSharper disable once PossibleNullReferenceException
                NoteRepozitory.Delete(note.Id);
                FetchDataFromDatabase();
            }
            catch (Exception e)
            {
                ModalWindowPresenter.ShowErrorMessage("DeleteNoteException", e);
            }
        }
Пример #4
0
        public static void ShowInformationMessage(FrameworkElement view)
        {
            var informationViewsettings = new ModalWindowSettings
            {
                Title      = LanguageDictionary.GetValue("InformationMessage"),
                ResizeMode = ResizeMode.CanResize,
                MinWidth   = 400
            };

            ShowModal(view, ControlsCreator.GetOkButton(CloseCurrentWindowCommand));
        }
Пример #5
0
        public static void ShowErrorMessage(string languageKey, params object[] items)
        {
            var errorViewsettings = new ModalWindowSettings
            {
                Title      = LanguageDictionary.GetValue("Error"),
                ResizeMode = ResizeMode.CanResize
            };
            var view = ControlsCreator.GetSimpleTextView(languageKey, errorViewsettings, items);

            ShowModal(view, ControlsCreator.GetCustomCancelButton(LanguageDictionary.GetFormatValue("Close", items)));
        }
Пример #6
0
        public static void ShowInformationMessage(string languageKey, params object[] items)
        {
            var informationViewsettings = new ModalWindowSettings
            {
                Title      = LanguageDictionary.GetValue("InformationMessage"),
                ResizeMode = ResizeMode.CanResize,
                MinWidth   = 400
            };
            var view = ControlsCreator.GetSimpleTextView(languageKey, informationViewsettings, items);

            ShowModal(view, ControlsCreator.GetOkButton(CloseCurrentWindowCommand));
        }
    public void ShowCustomModalWindow()
    {
        ModalWindowSettings settings = new ModalWindowSettings()
        {
            title   = "Custom message with one button",
            message = "Ia! Ia! Kathulhu ftagh'n! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!",
            buttons = new string[] { "A button" },
            handler = modalButtonsHandler,
        };

        this.ShowModalWindow(settings, "CustomModalWindow");
    }
    public void ShowCustomModalWindowWithTooManyButtons()
    {
        ModalWindowSettings settings = new ModalWindowSettings()
        {
            overrideActiveModalWindow = true,
            title   = "Custom message with one button",
            message = "Ia! Ia! Kathulhu ftagh'n! Ph'nglui mglw'nfah Cthulhu R'lyeh wgah'nagl fhtagn!",
            buttons = new string[] { "Yes", "No" },
            handler = modalButtonsHandler,
        };

        this.ShowModalWindow(settings, "CustomModalWindow");
    }
    protected override void InitModalWindow(ModalWindowSettings settings)
    {
        base.InitModalWindow(settings);

        if (statusBarTextComponent != null)
        {
            if (settings.buttons != null && settings.buttons.Length > 1)
            {
                statusBarTextComponent.text = "This modal window cannot display more than one button!";
            }
            else
            {
                statusBarTextComponent.text = "This is an example of a custom modal window!";
            }
        }
    }
 public ConfirmationTextControl(string confirmationText, ModalWindowSettings settings = null)
 {
     InitializeComponent();
     PART_Text.Text = confirmationText;
     WindowSettings = settings;
 }
Пример #11
0
 public static FrameworkElement GetSimpleTextView(string languageKey, ModalWindowSettings settings, params object[] items)
 {
     return(new ConfirmationTextControl(LanguageDictionary.GetFormatValue(languageKey, items), settings));
 }
Пример #12
0
 public static FrameworkElement GetSimpleTextView(string languageKey, ModalWindowSettings settings = null)
 {
     return(new ConfirmationTextControl(LanguageDictionary.GetValue(languageKey), settings));
 }