private void DisplayPrompt(PreferenceType preferenceType, string title, string text, string checkText) { if (!preferences.GetSavePromptPreference(preferenceType)) { return; } PromptView prompt = Injector.GetInstance <PromptView>(); CheckBoxData checkData = new CheckBoxData(preferenceType, checkText); prompt.Initialize(title, text, new CheckBoxData[] { checkData }); bool?result = prompt.ShowDialog(); if (result == false) { args.CancelLoading(); } if (prompt.RememberChoice && prompt.GetChecked(preferenceType)) { preferences.SetPromptPreference(preferenceType, false); database.SavePromptSavePref(preferenceType, false); } }
public static bool PromptUserIfOutsideOfCenterScreenPlaceholders(PlaceHolderCollectionModel collectionModel, UserPreferencesModel preferences, Database database) { if (preferences.PromptOutsidePlaceholders == OutsidePlaceholdersPrefType.DO_NOTHING) { return(false); } bool outsidePlaceholder = false; foreach (PlaceholderModel placeholder in collectionModel.Items) { ScreenPositionType screen = ScreenUtils.GetScreen(placeholder); if (screen != ScreenPositionType.CENTER) { outsidePlaceholder = true; break; } } if (outsidePlaceholder) { if (preferences.PromptOutsidePlaceholders == OutsidePlaceholdersPrefType.MOVE) { MovePlaceholders(collectionModel); } else if (preferences.PromptOutsidePlaceholders == OutsidePlaceholdersPrefType.PROMPT) { PromptView prompt = Injector.GetInstance <PromptView>(); CheckBoxData checkData = new CheckBoxData(PreferenceType.PROMPT_OUTSIDE_PLACEHOLDER, "Remember my choice"); prompt.Initialize("Placeholder(s) outside of center screen", "Some placeholders are now outside of the screen.\nMove them to center screen?", new CheckBoxData[] { checkData }); bool result = (bool)prompt.ShowDialog(); if (prompt.RememberChoice && prompt.GetChecked(PreferenceType.PROMPT_OUTSIDE_PLACEHOLDER)) { if (result) { preferences.PromptOutsidePlaceholders = OutsidePlaceholdersPrefType.MOVE; database.SaveOutsidePlaceholdersPref(OutsidePlaceholdersPrefType.MOVE); } else { preferences.PromptOutsidePlaceholders = OutsidePlaceholdersPrefType.DO_NOTHING; database.SaveOutsidePlaceholdersPref(OutsidePlaceholdersPrefType.DO_NOTHING); } } if (result) { MovePlaceholders(collectionModel); return(true); } } } return(false); }
void ReleaseDesignerOutlets() { if (ConnectionTimeout != null) { ConnectionTimeout.Dispose(); ConnectionTimeout = null; } if (DBInitialisedOn != null) { DBInitialisedOn.Dispose(); DBInitialisedOn = null; } if (UpdateAppUri != null) { UpdateAppUri.Dispose(); UpdateAppUri = null; } if (EventUTCOffset != null) { EventUTCOffset.Dispose(); EventUTCOffset = null; } if (NotificationsBtn != null) { NotificationsBtn.Dispose(); NotificationsBtn = null; } if (PromptsBtn != null) { PromptsBtn.Dispose(); PromptsBtn = null; } if (LogsBtn != null) { LogsBtn.Dispose(); LogsBtn = null; } if (PromptView != null) { PromptView.Dispose(); PromptView = null; } if (NotificationView != null) { NotificationView.Dispose(); NotificationView = null; } if (CancelBtn != null) { CancelBtn.Dispose(); CancelBtn = null; } if (DatabaseSize != null) { DatabaseSize.Dispose(); DatabaseSize = null; } if (RunningMode != null) { RunningMode.Dispose(); RunningMode = null; } if (CurrentVersion != null) { CurrentVersion.Dispose(); CurrentVersion = null; } if (GoLiveDate != null) { GoLiveDate.Dispose(); GoLiveDate = null; } if (ResponderRegion != null) { ResponderRegion.Dispose(); ResponderRegion = null; } if (EventPasscode != null) { EventPasscode.Dispose(); EventPasscode = null; } if (RefreshViewBtn != null) { RefreshViewBtn.Dispose(); RefreshViewBtn = null; } if (EventName != null) { EventName.Dispose(); EventName = null; } if (SyncDataBtn != null) { SyncDataBtn.Dispose(); SyncDataBtn = null; } if (ResponderId != null) { ResponderId.Dispose(); ResponderId = null; } if (SyncDataInterval != null) { SyncDataInterval.Dispose(); SyncDataInterval = null; } if (SyncMode != null) { SyncMode.Dispose(); SyncMode = null; } if (WANServiceUri != null) { WANServiceUri.Dispose(); WANServiceUri = null; } if (SaveChangesBtn != null) { SaveChangesBtn.Dispose(); SaveChangesBtn = null; } if (LANServiceUri != null) { LANServiceUri.Dispose(); LANServiceUri = null; } if (LastSuccessfulDataPush != null) { LastSuccessfulDataPush.Dispose(); LastSuccessfulDataPush = null; } if (LogView != null) { LogView.Dispose(); LogView = null; } if (LastSuccessfulServiceUpdate != null) { LastSuccessfulServiceUpdate.Dispose(); LastSuccessfulServiceUpdate = null; } }
private bool CheckUnsavedChanges() { string text = ""; bool promptUser = false; List <CheckBoxData> checkData = new List <CheckBoxData>(); UnsavedChangeType saved = layoutIO.GetSaveStatus(); bool twoPrompts = !saved.HasFlag(UnsavedChangeType.PROFILE) && preferences.GetSavePromptPreference(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT) && !saved.HasFlag(UnsavedChangeType.R3E) && preferences.GetSavePromptPreference(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT); string listHeader = twoPrompts ? "* " : ""; if (!saved.HasFlag(UnsavedChangeType.PROFILE) && preferences.GetSavePromptPreference(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT)) { checkData.Add(new CheckBoxData(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT, "Don't ask for unsaved profile when exiting application")); text += $"{listHeader}Profile \"{selectedProfile.Selection.Name}\" has unsaved changes.\n"; promptUser = true; } if (!saved.HasFlag(UnsavedChangeType.R3E) && preferences.GetSavePromptPreference(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT)) { checkData.Add(new CheckBoxData(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT, "Don't ask for unapplied layout when exiting application")); text += $"{listHeader}Current layout is not applied to R3E.\n"; promptUser = true; } text += "Exit anyway?"; if (!promptUser) { return(true); } PromptView prompt = Injector.GetInstance <PromptView>(); prompt.Initialize("Unsaved changes", text, checkData.ToArray()); bool result = (bool)prompt.ShowDialog(); if (prompt.RememberChoice && prompt.HasCkeck(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT) && prompt.GetChecked(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT)) { preferences.SetPromptPreference(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT, false); database.SavePromptSavePref(PreferenceType.PROMPT_SAVE_PROFILE_APP_EXIT, false); } if (prompt.RememberChoice && prompt.HasCkeck(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT) && prompt.GetChecked(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT)) { preferences.SetPromptPreference(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT, false); database.SavePromptSavePref(PreferenceType.PROMPT_APPLY_LAYOUT_APP_EXIT, false); } if (!result) { args.FormArgs.Cancel = true; return(false); } return(true); }