Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 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;
     }
 }
Beispiel #4
0
 private static void executeWithinTryCatchBlock(Action action)
 {
     try
     {
         action.Invoke();
     }
     catch (Exception ex)
     {
         UserDialogUtils.displayError("Exception Encountered", ex.Message);
     }
 }