private void selectLens(string alias, string selectedLensName) { TabPage existingLensTabPage = ( editorPaneTC .TabPages.Cast <TabPage>() .FirstOrDefault( tp => lensTabTextToLensName(tp.Text) == selectedLensName ) ); if (existingLensTabPage != default(TabPage)) { editorPaneTC.SelectedTab = existingLensTabPage; return; } if ( !UserDialogUtils.obtainConfirmation( "Unrecognized LiveCam Lens Reference", $"Add Lens '{selectedLensName}' to LiveCam '{alias}'?" ) ) { return; } editorPaneTC.SelectedTab = addNewLensTabPage(selectedLensName); TryUpdateLiveCam(out _); }
private void newBT_Click(object sender, EventArgs e) { string newLensName; if ( UserDialogUtils.TryGetStringInput( "Lens Name (leave empty for initial lens):", "Create LiveCam Lens", out newLensName, UserDialogUtils.LettersOrDigitsOnlyInputKeyPressHandler, proposedLensName => { if (IsLensDefined(proposedLensName)) { UserDialogUtils.displayError( "Unavailable Lens Name", $"Lens '{proposedLensName}' is already defined for this LiveCam.\nPlease choose another." ); return(false); } return(true); } ) ) { editorPaneTC.SelectedTab = addNewLensTabPage(newLensName); } }
private void Handle_LiveCamDefinitionRename_Event(object sender, EventArgs e) { string duplicateAlias; if ( !UserDialogUtils.TryGetStringInput( "Enter new alias", "Rename LiveCam Definition", out duplicateAlias, UserDialogUtils.LettersOrDigitsOnlyInputKeyPressHandler, proposedNewAlias => { if (!isAliasAvailableFn.Invoke(proposedNewAlias)) { UserDialogUtils.displayError( "Unavailable Alias", $"Alias '{proposedNewAlias}' is not available.\nPlease choose another." ); return(false); } return(true); } ) ) { return; } alias = duplicateAlias; InitializeForAlias(); }
private void Handle_KmlTextValidation_Event(object sender, CancelEventArgs e) { string[] diagnostics; if (!TryUpdateLiveCam(out diagnostics)) { UserDialogUtils.displayError("Validation Error(s)", string.Join("\n", diagnostics)); e.Cancel = true; } }
private static void executeWithinTryCatchBlock(Action action) { try { action.Invoke(); } catch (Exception ex) { UserDialogUtils.displayError("Exception Encountered", ex.Message); } }
private bool IsLosingChangesOkay() { if (initialKmlLiveCam.Equals(kmlLiveCam) && !textChanged) { return(true); } return( UserDialogUtils.obtainConfirmation( "Confirm Abandon Changes", "Changes will be lost.\nDo you wish to continue?" ) ); }
private void showHelp() { UserDialogUtils.showHelpPopupText( this, $@"Permitted substitution values: Camera Template: {"\t" + string.Join("\n\t", TextRenderer.Placeholders(typeof(KmlCameraParameterValues)))} See: https://developers.google.com/kml/documentation/kmlreference" ); }
private void deleteBT_Click(object sender, EventArgs e) { TabPage currentLensTab = editorPaneTC.SelectedTab; if (currentLensTab == null) { return; } if ( UserDialogUtils.obtainConfirmation( "Confirm Deletion of Lens", $"Delete Lens '{currentLensTab.Text}'?", MessageBoxIcon.Warning ) ) { editorPaneTC.TabPages.Remove(currentLensTab); TryUpdateLiveCam(out _); } }
private void TimerTickHandler(object sender, EventArgs e) { UserDialogUtils.PostMessage(parentControl.Handle, WM_USER_SIMCONNECT, 0, 0); }