static void UpdateSinglePresetBox(ComboBox box, VideoSettings refreshSettings = null) { if (refreshSettings != null) { refreshSettings.refreshBox = false; } int oldVal = box.SelectedIndex; box.Items.Clear(); foreach (string s in RTSPPresets.GetPresetList()) { box.Items.Add(s); } box.Items.Add("Add New..."); if (oldVal <= box.Items.Count - 2) { box.SelectedIndex = oldVal; } if (refreshSettings != null) { refreshSettings.refreshBox = true; } }
public static void UpdateAllPresetBoxes(bool force = false, bool refresh = true) { if (!MainForm.m.finishedLoading && !force) { return; } VideoSettings v = null; //if the box needs to be repopulated without triggering a selectindex update foreach (VideoSettings vs in allSettings) { if (!refresh) { v = vs; } UpdateSinglePresetBox(vs.cB_RTSP, v); } foreach (TabPage tp in MainForm.m.mainPlayer.settings.tC_PlayerSettings.TabPages) { if (tp == MainForm.m.mainPlayer.settings.tP_Main) { continue; } UpdateSinglePresetBox((ComboBox)FindControl(tp, MainForm.m.mainPlayer.settings.cB_RTSP), MainForm.m.mainPlayer.settings); } UpdateSinglePresetBox(MainForm.m.setPage.cB_IPCon_MainPlayerPreset); //need to look into what happens if this doesnt get refresh affected }
public static void UpdateControlFields() { VideoSettings vs = MainForm.m.mainPlayer.settings; vs.tB_IP.Text = ConfigControl.savedIP.stringVal; vs.cB_Port.Text = ConfigControl.savedPort.stringVal; vs.cB_ID.Text = Tools.MakeAdr().ToString(); }
public RTSPWizard(string[] preset, VideoSettings sets, Hidden.FirstTime firstWindow = null) { InitializeComponent(); first = firstWindow; mySets = sets; OpenPreset(preset); UpdateAll(); }
public static void OpenEdit(VideoSettings sets) { string rtspName = sets.cB_RTSP.Text; if (rtspName.Length > 0 && rtspName.Trim().Length > 0) { RTSPPresets.OpenPreset(sets.cB_RTSP.Text, sets); return; } }
public static void OpenPreset(string presetName, VideoSettings sets) { if (wiz != null) { wiz.Dispose(); } wiz = new RTSPWizard(GetPreset(presetName), sets); wiz.Show(); }
public static void SwapSettings(VideoSettings second) { try { ComboBox mainBox = MainForm.m.mainPlayer.settings.cB_RTSP; int mainIndex = mainBox.SelectedIndex; mainBox.SelectedIndex = second.cB_RTSP.SelectedIndex; second.cB_RTSP.SelectedIndex = mainIndex; } catch (Exception e) { MessageBox.Show("Swap Fail\n" + e.ToString()); } }
public static void CreateNew(VideoSettings sets, Hidden.FirstTime firstWindow = null) { RTSPWizard wiz = new RTSPWizard(null, sets, firstWindow); if (firstWindow != null) { firstWindow.Hide(); wiz.ShowDialog(); } else { wiz.Show(); } }
public static async Task <bool> TryConnect(bool showErrors = false, IPEndPoint customep = null) //Return true or false if Connect worked { bool result = true; //needs to be on true try { if (connectingAlready) { return(false); } connectingAlready = true; if (ConfigControl.savedIP.stringVal.Length == 0 || ConfigControl.savedPort.stringVal.Length == 0) { result = false; } if (customep == null) { customep = new IPEndPoint(IPAddress.Parse(ConfigControl.savedIP.stringVal), int.Parse(ConfigControl.savedPort.stringVal)); } if (result) { result = Connect(customep, showErrors); } } catch (Exception e) { if (showErrors) { Tools.ShowPopup("Failed to initialize connection to camera!\nShow more?", "Connection Attempt Failed!" , e.ToString()); } Console.WriteLine(e.ToString()); result = false; } if (result && ConfigControl.legacyLayout.stringVal.ToUpper() == "LEGACY") { ConfigControl.savedIP.UpdateValue(MainForm.m.tB_Legacy_IP.Text); ConfigControl.savedPort.UpdateValue(MainForm.m.tB_Legacy_Port.Text); } connectingAlready = false; OtherCamCom.LabelDisplay(result); VideoSettings.UpdateControlFields(); return(result); }
public Detached(bool isMain, bool autoPlay = false) { InitializeComponent(); settings = new VideoSettings(this, isMain); CreateHandle(); if (isMain) { p_Player = MainForm.m.p_PlayerPanel; } else if (autoPlay && settings.cB_RTSP.Items.Count > 1) { settings.cB_RTSP.SelectedIndex = 0; } MainForm.m.detachedList.Add(this); }
public static TabPage CopyPage(VideoSettings originalSets) { TabPage tp = new TabPage(); try { VideoSettings mainSettings = MainForm.m.mainPlayer.settings; tp.Size = mainSettings.tP_Main.Size; foreach (Control c in mainSettings.tP_Main.Controls) { Control copyC = null; if (c.GetType() == typeof(Label)) { Label copyL = new Label(); Label l = new Label(); l = (Label)c; copyL.AutoSize = true; copyC = copyL; } if (c.GetType() == typeof(ComboBox)) { ComboBox cb = new ComboBox(); ComboBox copyCB = new ComboBox(); cb = (ComboBox)c; foreach (var entry in cb.Items) { copyCB.Items.Add(entry); } copyC = copyCB; copyCB.SelectedIndexChanged += (s, e) => { originalSets.cB_RTSP.SelectedIndex = copyCB.SelectedIndex; }; copyCB.TextChanged += (s, e) => { originalSets.CBTextChanged(); }; copyCB.FlatStyle = cb.FlatStyle; copyCB.DropDownStyle = cb.DropDownStyle; } else if (c.GetType() == typeof(Button)) { Button b = new Button(); Button copyB = new Button(); b = (Button)c; copyB.FlatStyle = b.FlatStyle; copyC = copyB; } if (copyC != null) { copyC.Anchor = c.Anchor; copyC.Location = c.Location; copyC.Size = c.Size; copyC.Name = c.Name; copyC.BackColor = c.BackColor; copyC.Font = c.Font; copyC.Visible = true; if (copyC.GetType() == typeof(Button)) { copyC.Visible = false; } if (copyC.GetType() != typeof(ComboBox)) { copyC.Text = c.Text; } tp.Controls.Add(copyC); } } FindControl(tp, mainSettings.b_Edit).Click += (s, e) => { originalSets.b_Edit_Click(s, e); }; FindControl(tp, mainSettings.b_Play).Click += (s, e) => { originalSets.myDetached.Play(true, false); }; FindControl(tp, mainSettings.b_Stop).Click += (s, e) => { originalSets.myDetached.StopPlaying(); }; tp.BackColor = mainSettings.tP_Main.BackColor; } catch (Exception e) { MessageBox.Show("SPAWN TAB\n" + e.ToString()); } return(tp); }
private void b_IPCon_Edit_Click(object sender, EventArgs e) { VideoSettings.OpenEdit(MainForm.m.mainPlayer.settings); }
static void ReloadAll() { //Reloads all settings every time this is updated, make a way so it reloads after it finishes loading later VideoSettings.UpdateAllPresetBoxes(); }
public static void Reload(bool force) { allPresets = new string[columns, 99]; currentPresetCount = 0; VideoSettings.UpdateAllPresetBoxes(force); }