Example #1
0
        void CompleteControlValues()
        {
            string presetName = cB_RTSP.Text;
            string id         = "";
            string ip         = "";
            string port       = "";

            if (presetName.Length > 0)
            {
                id   = RTSPPresets.GetValue(PresetColumn.PelcoID, presetName);
                ip   = RTSPPresets.GetValue(PresetColumn.ControlIP, presetName);
                port = RTSPPresets.GetValue(PresetColumn.ControlPort, presetName);
            }

            if (id == "")
            {
                id = "0";
            }

            if (ip == "")
            {
                ip = MainForm.m.setPage.tB_IPCon_Adr.Text;
            }

            if (port == "")
            {
                port = MainForm.m.setPage.cB_IPCon_Port.Text;
            }

            cB_ID.Text   = id;
            tB_IP.Text   = ip;
            cB_Port.Text = port;
        }
Example #2
0
        public void LoadPlayer(string presetName, bool autoPlay)
        {
            string indexVal    = RTSPPresets.GetValue(PresetColumn.Index, presetName);
            int    presetIndex = 0;

            if (indexVal != "")
            {
                presetIndex = int.Parse(indexVal);
            }

            if (presetIndex >= RTSPPresets.currentPresetCount)
            {
                presetIndex = MainForm.m.mainPlayer.attachedPlayers.IndexOf(myDetached) + 1;
                if (presetIndex >= RTSPPresets.currentPresetCount)
                {
                    return;
                }
            }

            cB_RTSP.SelectedIndex = presetIndex;

            if (autoPlay)
            {
                myDetached.Play(false, false);
            }
            if (isMainPlayer)
            {
                MainForm.m.setPage.cB_IPCon_MainPlayerPreset.SelectedIndex = cB_RTSP.SelectedIndex;
            }
        }
Example #3
0
        public int GetPelcoID()
        {
            string val = RTSPPresets.GetValue(PresetColumn.PelcoID, ConfigControl.mainPlayerPreset.stringVal);
            int    returnVal;

            if (!int.TryParse(val, out returnVal))
            {
                returnVal = -1;
            }

            return(returnVal);
        }
Example #4
0
        private void b_Confirm_Click(object sender, EventArgs e)
        {
            //Name;FullAdr;RTSPIP;RTSPPort;RTSP;Username;Password;PelcoID;ControlIP;ControlPort;

            string name        = tB_Name.Text;
            string fullAdr     = tB_FullAdr.Text;
            string ipaddress   = tB_RTSPIP.Text;
            string port        = tB_RTSPPort.Text;
            string url         = tB_RTSPString.Text;
            string username    = tB_Username.Text;
            string password    = tB_Password.Text;
            string pelco       = tB_PelcoID.Text;
            string controlip   = tB_ControlIP.Text;
            string controlport = cB_ControlPort.Text;

            string full = name + ";" + fullAdr + ";" + ipaddress + ";" + port + ";" + url + ";" + username
                          + ";" + password + ";" + pelco + ";" + controlip + ";" + controlport + ";";

            if (name.Length <= 0 || fullAdr.Length <= 0 || pelco.Length <= 0)
            {
                MessageBox.Show("Invalid RTSP values!\nPreset Name, Full Address, and Pelco ID must be completed!");
                return;
            }

            string stringCheckIndex = RTSPPresets.GetValue(RTSPPresets.PresetColumn.Index, tB_Name.Text);
            int    checkIndex       = -1;

            if (stringCheckIndex != "")
            {
                checkIndex = int.Parse(stringCheckIndex);
            }

            if (editIndex >= 0)   //existing
            {
                mySets.cB_RTSP.SelectedIndex = RTSPPresets.LoadPreset(full, editIndex);
            }
            else if (checkIndex != -1)     //duplicate
            {
                MessageBox.Show("Duplicate preset name!");
                return;
            }
            else     //new
            {
                mySets.cB_RTSP.SelectedIndex = RTSPPresets.LoadPreset(full);
            }

            CloseWindow();
        }
Example #5
0
        void OpenPreset(string[] preset)
        {
            if (preset != null)
            {
                string retVal = RTSPPresets.GetValue(RTSPPresets.PresetColumn.Index, preset[0], RTSPPresets.PresetColumn.Name);
                if (retVal != "")
                {
                    editIndex = int.Parse(retVal);
                }

                if (editIndex != -1)
                {
                    LoadPreset(preset);
                    b_Forget.Visible = true;
                }

                check_Manual.Checked = (preset[RTSPPresets.TableValue(RTSPPresets.PresetColumn.ControlIP)] != "" ||
                                        preset[RTSPPresets.TableValue(RTSPPresets.PresetColumn.ControlPort)] != "" ||
                                        preset[RTSPPresets.TableValue(RTSPPresets.PresetColumn.PelcoID)] != "1");
            }
        }
Example #6
0
 public string GetCombined()
 {
     return(RTSPPresets.GetValue(PresetColumn.FullAdr, cB_RTSP.Text));
 }
Example #7
0
 public string GetRTSPIP()
 {
     return(RTSPPresets.GetValue(PresetColumn.RTSPIP, cB_RTSP.Text));
 }
Example #8
0
        private void cB_RTSP_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!MainForm.m.finishedLoading || !refreshBox)
            {
                return;
            }

            previousIndex = cB_RTSP.SelectedIndex;

            if (cB_RTSP.Text == "")
            {
                toolTip1.SetToolTip(cB_RTSP, "Select a camera preset");
                return;
            }

            bool visibleBool = false;

            if (cB_RTSP.SelectedIndex == cB_RTSP.Items.Count - 1)
            {
                if (previousIndex != -1 || isMainPlayer)
                {
                    RTSPPresets.CreateNew(this);
                }
            }
            else
            {
                //Use new settings
                if (cB_RTSP.Text != "")
                {
                    visibleBool = true;
                }

                if (isMainPlayer)
                {
                    MainForm.m.setPage.cB_IPCon_MainPlayerPreset.SelectedIndex = cB_RTSP.SelectedIndex;
                }

                if (!check_Manual.Checked)
                {
                    CompleteControlValues();
                }
            }

            UpdateButtonVisibility(visibleBool);

            string rtspText = cB_RTSP.Text;

            if (isMainPlayer)
            {
                ConfigControl.mainPlayerPreset.UpdateValue(rtspText);
                MainForm.m.setPage.b_IPCon_Edit.Visible = visibleBool;
            }
            else if (myLinkedPage != null)
            {
                int pageIndex = MainForm.m.mainPlayer.settings.tC_PlayerSettings.TabPages.IndexOf(myLinkedPage);
                if (pageIndex == 1)
                {
                    ConfigControl.player2Preset.UpdateValue(rtspText);
                }
                else if (pageIndex == 2)
                {
                    ConfigControl.player3Preset.UpdateValue(rtspText);
                }
            }

            string fullAdr = RTSPPresets.GetValue(PresetColumn.FullAdr, cB_RTSP.Text);

            toolTip1.SetToolTip(cB_RTSP, fullAdr);
            myDetached.Play(false, false);
        }