예제 #1
0
        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 _);
        }
예제 #2
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);
            }
        }
예제 #3
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();
        }
예제 #4
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;
     }
 }
예제 #5
0
 private static void executeWithinTryCatchBlock(Action action)
 {
     try
     {
         action.Invoke();
     }
     catch (Exception ex)
     {
         UserDialogUtils.displayError("Exception Encountered", ex.Message);
     }
 }
예제 #6
0
 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?"
             )
         );
 }
예제 #7
0
        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"
                );
        }
예제 #8
0
        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 _);
            }
        }
예제 #9
0
 private void TimerTickHandler(object sender, EventArgs e)
 {
     UserDialogUtils.PostMessage(parentControl.Handle, WM_USER_SIMCONNECT, 0, 0);
 }