예제 #1
0
        public static NotepadsDialog GetFileOpenErrorDialog(string filePath, string errorMsg)
        {
            NotepadsDialog fileOpenErrorDialog = new NotepadsDialog
            {
                Title             = ResourceLoader.GetString("FileOpenErrorDialog_Title"),
                Content           = string.IsNullOrEmpty(filePath) ? errorMsg : string.Format(ResourceLoader.GetString("FileOpenErrorDialog_Content"), filePath, errorMsg),
                PrimaryButtonText = ResourceLoader.GetString("FileOpenErrorDialog_PrimaryButtonText"),
                RequestedTheme    = ThemeSettingsService.ThemeMode
            };

            return(fileOpenErrorDialog);
        }
예제 #2
0
        public static NotepadsDialog GetRevertAllChangesConfirmationDialog(string fileNameOrPath, Action confirmedAction)
        {
            NotepadsDialog revertAllChangesConfirmationDialog = new NotepadsDialog
            {
                Title             = ResourceLoader.GetString("RevertAllChangesConfirmationDialog_Title"),
                Content           = string.Format(ResourceLoader.GetString("RevertAllChangesConfirmationDialog_Content"), fileNameOrPath),
                PrimaryButtonText = ResourceLoader.GetString("RevertAllChangesConfirmationDialog_PrimaryButtonText"),
                CloseButtonText   = ResourceLoader.GetString("RevertAllChangesConfirmationDialog_CloseButtonText"),
                RequestedTheme    = ThemeSettingsService.ThemeMode,
            };

            revertAllChangesConfirmationDialog.PrimaryButtonClick += (dialog, args) => { confirmedAction(); };
            return(revertAllChangesConfirmationDialog);
        }
예제 #3
0
        public static NotepadsDialog GetSetCloseSaveReminderDialog(string fileNameOrPath, Action saveAction, Action skipSavingAction)
        {
            NotepadsDialog setCloseSaveReminder = new NotepadsDialog
            {
                Title               = ResourceLoader.GetString("SetCloseSaveReminderDialog_Title"),
                Content             = string.Format(ResourceLoader.GetString("SetCloseSaveReminderDialog_Content"), fileNameOrPath),
                PrimaryButtonText   = ResourceLoader.GetString("SetCloseSaveReminderDialog_PrimaryButtonText"),
                SecondaryButtonText = ResourceLoader.GetString("SetCloseSaveReminderDialog_SecondaryButtonText"),
                CloseButtonText     = ResourceLoader.GetString("SetCloseSaveReminderDialog_CloseButtonText"),
                RequestedTheme      = ThemeSettingsService.ThemeMode,
            };

            setCloseSaveReminder.PrimaryButtonClick   += (dialog, args) => { saveAction(); };
            setCloseSaveReminder.SecondaryButtonClick += (dialog, args) => { skipSavingAction(); };
            return(setCloseSaveReminder);
        }
예제 #4
0
        public static NotepadsDialog GetAppCloseSaveReminderDialog(Action saveAndExitAction, Action discardAndExitAction, Action cancelAction)
        {
            NotepadsDialog saveReminderDialog = new NotepadsDialog
            {
                Title = ResourceLoader.GetString("AppCloseSaveReminderDialog_Title"),
                HorizontalAlignment = HorizontalAlignment.Center,
                Content             = ResourceLoader.GetString("AppCloseSaveReminderDialog_Content"),
                PrimaryButtonText   = ResourceLoader.GetString("AppCloseSaveReminderDialog_PrimaryButtonText"),
                SecondaryButtonText = ResourceLoader.GetString("AppCloseSaveReminderDialog_SecondaryButtonText"),
                CloseButtonText     = ResourceLoader.GetString("AppCloseSaveReminderDialog_CloseButtonText"),
                RequestedTheme      = ThemeSettingsService.ThemeMode,
                PrimaryButtonStyle  = GetButtonStyle(Color.FromArgb(255, 38, 114, 201)),
            };

            saveReminderDialog.PrimaryButtonClick   += (dialog, eventArgs) => saveAndExitAction();
            saveReminderDialog.SecondaryButtonClick += (dialog, eventArgs) => discardAndExitAction();
            saveReminderDialog.CloseButtonClick     += (dialog, eventArgs) => cancelAction();
            return(saveReminderDialog);
        }