Exemplo n.º 1
0
        private bool TryUpdateLiveCam(out string[] diagnostics)
        {
            if (!textChanged)
            {
                diagnostics = new string[0];
                return(true);
            }

            string[] lensTabNames = editorPaneTC.TabPages.Cast <TabPage>().Select(tp => tp.Name).ToArray();

            KmlLiveCam updatedKmlLiveCam = new KmlLiveCam(
                new LiveCamEntity(
                    lensTabNames.Select(
                        lensTabName => new LiveCamLensEntity(
                            lensTabTextToLensName(editorPaneTC.TabPages[lensTabName].Text),
                            editorPaneTC.TabPages[lensTabName].Controls[0].Text
                            )
                        )
                    .ToArray()
                    )
                );

            diagnostics = updatedKmlLiveCam.Diagnostics;
            if (diagnostics.Length > 0)
            {
                return(false);
            }

            kmlLiveCam  = updatedKmlLiveCam;
            textChanged = false;

            return(true);
        }
Exemplo n.º 2
0
        public KmlLiveCamEditorForm(
            string alias,
            string selectedLensName,
            KmlLiveCam kmlLiveCam,
            Func <string, KmlLiveCam> loadKmlLiveCamFromFileFn,
            Action <string, KmlLiveCam> saveKmlLiveCamToFileFn,
            Func <string, bool> isAliasAvailableFn
            )
        {
            InitializeComponent();

            this.alias                    = alias;
            this.selectedLensName         = selectedLensName;
            this.kmlLiveCam               = kmlLiveCam;
            this.loadKmlLiveCamFromFileFn = loadKmlLiveCamFromFileFn;
            this.saveKmlLiveCamToFileFn   = saveKmlLiveCamToFileFn;
            this.isAliasAvailableFn       = isAliasAvailableFn;
            this.initialKmlLiveCam        = this.kmlLiveCam;

            InitializeKmlLiveCam();
        }
Exemplo n.º 3
0
 private void replaceLoadedLiveCam(KmlLiveCam newKmlLiveCam)
 {
     Console.WriteLine($"loading new LiveCam({newKmlLiveCam})");
     kmlLiveCam = newKmlLiveCam;
     InitializeKmlLiveCam();
 }