private void btnClear_Click(object sender, EventArgs e) { if (DialogResult.Yes == FCYesNoMsgBox.ShowDialog("Clear all presets?", "Are you sure you want to permenently delete all current presets?", this)) { Clear(true); } }
protected override void HandleOKClick() { if (!ValidateServerConfiguration()) { return; } AppUser.Current.TunerDeviceName = TunerName; AppUser.Current.SnapshotInterval = AutoSnapInterval; AppUser.Current.SnapshotMaximum = AutoSnapMaximum; AppUser.Current.TunerInputType = TunerInputType; AppUser.Current.ServerSourceName = ServerSource; AppUser.Current.ServerAddress = CHK_ShowNetwork.Checked ? ServerAddress : string.Empty; AppUser.Current.TVMode = (TVMode)Enum.Parse(typeof(TVMode), cbInputMode.SelectedItem.ToString()); AppUser.Current.TVSource = (TVSource)Enum.Parse(typeof(TVSource), cbSourceType.SelectedItem.ToString()); if (!AppUser.Current.SaveSettings()) { if (DialogResult.No == FCYesNoMsgBox.ShowDialog("Error while saving!", "There was an error while saving the settings. Would you like to continue anyway?", this)) { return; } } this.Close(); }
private void btnClear_Click(object sender, EventArgs e) { if (FCYesNoMsgBox.ShowDialog("Clear favorites", "Are you sure you want to clear your list of favorite channels?", new Size(380, 125), this) == DialogResult.Yes) { Clear(); } }
/// <summary> /// Returns true if the server configuration is valid, or the user wants to keep it /// </summary> /// <returns>true if valid and should be saved, false if dialog should stay open</returns> private bool ValidateServerConfiguration() { if (!TunerName.Equals(VideoInputDeviceList.NetworkDeviceName)) { return(true); } ServerConfig server = null; try { server = new ServerConfig(ServerAddress); ServerInfo info = server.GetServerInfo(); bool foundSource = false; foreach (StreamSourceInfo i in info.StreamSources.Items) { foundSource = (i.SourceName == ServerSource); if (foundSource) { break; } } if (!foundSource) { throw new Exception("The server specified does not have any source called \"" + ServerSource + "\"!"); } return(true); } catch (Exception ex) { DialogResult r = FCYesNoMsgBox.ShowDialog("Problem with Network TV configuration", "Your Network TV configuration could not be verified. Would you like ignore this problem and keep these network settings anyway?" + Environment.NewLine + Environment.NewLine + ex.Message, this); return(r == DialogResult.Yes); } finally { if (server != null) { server.Dispose(); server = null; } } }
private void btnDelete_Click(object sender, EventArgs e) { if (lv.SelectedIndices.Count > 0) { if (DialogResult.Yes == FCYesNoMsgBox.ShowDialog("Remove preset?", "Are you sure you want to delete the preset \"" + Items[lv.SelectedIndices[0]].ToString() + "\"?", this)) { FirePresetDeleted(Items[lv.SelectedIndices[0]]); Delete(lv.SelectedIndices[0]); } } }
private void B_resetUserSettings_Click(object sender, EventArgs e) { if (DialogResult.Yes == FCYesNoMsgBox.ShowDialog("Reset User Settings?", "Are you sure you want to reset the user's settings? This includes TV mode, last used channel, volume, and other settings.", this)) { AppUser.Current.SetDefaults(); if (!AppUser.Current.SaveSettings()) { if (DialogResult.No == FCYesNoMsgBox.ShowDialog("Save failed!", "Saving the default settings to the disk failed. Continue anyway?", this)) { return; } } this.Close(); } }
private void Stream_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new PropertyChangedEventHandler(Stream_PropertyChanged), new object[] { sender, e }); return; } StreamViewerControl sv = sender as StreamViewerControl; if (e.PropertyName == "Active") { if (sv.Active) { ActiveStreamViewer = sv; } else if (sv.FullScreen) { Stream_FullScreenClicked(sv, new EventArgs()); } return; } if (e.PropertyName == "PendingConnection") { ConnectionChainDescriptor goingTo = sv.PendingConnection; if (goingTo != null) { StreamViewerControl existingViewer = this.FindViewerMatching(goingTo.Source); if (existingViewer != null) { StringBuilder message = new StringBuilder("You are already watching that camera."); if (existingViewer.State == StreamState.Recording) { message.AppendLine("Also, it's also being recorded."); } message.AppendLine(""); message.AppendLine("Moving that camera to this viewer will stop the"); message.AppendLine("existing viewer (and recording if applicable)"); message.AppendLine(""); message.AppendLine("Are you sure you want to move the camera to this viewer?"); if (DialogResult.Yes == FCYesNoMsgBox.ShowDialog("Move camera here", message.ToString(), this)) { existingViewer.Stop(); } else { throw new OperationCanceledException(); } } } } if (sv == ActiveStreamViewer) { switch (e.PropertyName) { case "State": profileGroupSelector.Visible = false; switch (sv.State) { case StreamState.Connecting: case StreamState.Buffering: case StreamState.Stopping: if (CurrentPalette != null) { CurrentPalette = null; } break; case StreamState.Playing: // if (sv.ProfileGroupSelectorEnabled) if (true) { profileGroupSelector.Enabled = true; profileGroupSelector.Visible = true; } profileGroupSelector.StreamViewer = ActiveStreamViewer; break; } break; } } }