static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { try { ErrorLogger.WriteToEventLog("Unhandled Thread Exception. See next entry for Exception dump.", EventLogEntryType.Error); ErrorLogger.DumpToEventLog(e.Exception, EventLogEntryType.Error); string path = FutureConcepts.Settings.GenericSettings.AntaresXDataPath + @"Output\SVD\Errors\"; Directory.CreateDirectory(path); StreamWriter streamWriter = new StreamWriter(path + "ThreadException.txt", true); streamWriter.WriteLine("-- Unhandled ThreadException @ " + DateTime.Now.ToString() + " --"); DumpException(streamWriter, e.Exception); ErrorLogger.DumpToDebug(e.Exception); streamWriter.Close(); streamWriter.Dispose(); } catch (Exception ex) { ErrorLogger.WriteToEventLog("Error while writing ThreadException log!", EventLogEntryType.Error); ErrorLogger.DumpToEventLog(ex); } finally { FCMessageBox.Show("Network Error", "Received network error---please restart Streaming Video Desktop [code 1]"); Application.Exit(); } }
private void btnVideoDecoderSettings_Click(object sender, EventArgs e) { string decoderName = null; SourcesConfig config = SourcesConfig.LoadFromFile(); Source s = config[cbTunerDevice.SelectedItem as string]; if (s.Name.Equals(VideoInputDeviceList.NetworkDeviceName)) { decoderName = s[TVSource.Network][FilterType.VideoDecoder].Name; } else if (s.HasGraphFor(TVSource.LocalDigital)) { decoderName = s[TVSource.LocalDigital][FilterType.VideoDecoder].Name; } if (string.IsNullOrEmpty(decoderName)) { FCMessageBox.Show("No Decoder Specified!", "No video decoder is specified for this particular tuner.", this); return; } IGraphBuilder g = null; IBaseFilter f = null; try { g = (IGraphBuilder) new FilterGraph(); f = FilterGraphTools.AddFilterByName(g, FilterCategory.LegacyAmFilterCategory, decoderName) as IBaseFilter; if (f == null) { throw new Exception("Could not instantiate video decoder \"" + decoderName + "\"!"); } FilterPropertyPage propPage = new FilterPropertyPage(this, f); propPage.Show(); } catch (Exception ex) { FCMessageBox.Show("Error!", ex.Message, this); } finally { if (f != null) { Marshal.ReleaseComObject(f); } if (g != null) { Marshal.ReleaseComObject(g); } } }
public override void ChannelDown() { try { _graphControlClient.ChannelDown(); } catch (Exception ex) { FCMessageBox.Show("TV Streamer Unavailable", "The TV Streamer is currently unavailable"); ErrorLogger.DumpToDebug(ex); } }
public void CancelChannelScan() { try { if (_graphControlClient != null) { _graphControlClient.CancelChannelScan(); } } catch (Exception ex) { FCMessageBox.Show("Could not cancel channel scan!", "The channel scan could not be canceled on the remote server."); ErrorLogger.DumpToDebug(ex); } }
private void sweep_StartSweep(object sender, EventArgs e) { try { //TODO sweep frequency client.ScanStartFrequency = ((UInt64)sweep.StartFrequency * (UInt64)1000000); client.ScanEndFrequency = ((UInt64)sweep.EndFrequency * (UInt64)1000000); client.ScanThreshold = sweep.Threshold; client.StartChannelScan(); } catch (Exception ex) { FCMessageBox.Show("Error starting frequency sweep!", @"There was an error starting the frequency sweep.", this); ErrorLogger.DumpToDebug(ex); } }
private void lblTunerDevice_DoubleClick(object sender, EventArgs e) { try { VideoInputDeviceList vidl = new VideoInputDeviceList(); vidl.PopulateAllDevices(); System.Diagnostics.Debug.WriteLine("<< Video input devices on system >>"); foreach (string id in vidl.Items) { System.Diagnostics.Debug.WriteLine(id); } } catch (Exception ex) { FCMessageBox.Show("Error!", ex.ToString(), this); } }
private void presets_RestorePreset(object sender, UserPresetEventArgs e) { try { client.RestorePreset(e.Item.Preset.ID); UpdateBusyStatus(0); UpdateBusyStatus(BusyFlags.Complete & ~BusyFlags.Tuning & ~BusyFlags.LQ); snapshotTimer.TakeSnapshot(e.Item, StreamViewerControl); } catch (Exception ex) { FCMessageBox.Show("Could not set restore preset", "There was an error while attempting to restore the preset.", this); ErrorLogger.DumpToDebug(ex); } }
static void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { ErrorLogger.WriteToEventLog("Unhandled AppDomain Exception. See next entry for Exception dump.", EventLogEntryType.Error); Exception exc = e.ExceptionObject as Exception; if (exc != null) { ErrorLogger.DumpToEventLog(e.ExceptionObject as Exception, EventLogEntryType.Error); } else { ErrorLogger.WriteToEventLog(e.ExceptionObject.GetType().ToString() + " " + e.ExceptionObject.ToString(), EventLogEntryType.Error); } string path = FutureConcepts.Settings.GenericSettings.AntaresXDataPath + @"Output\SVD\Errors\"; Directory.CreateDirectory(path); StreamWriter streamWriter = new StreamWriter(path + "AppDomainException.txt", true); streamWriter.WriteLine("-- Unhandled AppDomain Exception @ " + DateTime.Now.ToString() + " --"); if (exc != null) { streamWriter.WriteLine("found CLS-compliant exception"); DumpException(streamWriter, exc); ErrorLogger.DumpToDebug(exc); } else { string info = String.Format("--- Non-CLS-Compliant exception: Type={0}, String={1}", e.ExceptionObject.GetType(), e.ExceptionObject.ToString()); streamWriter.WriteLine(info); } streamWriter.Close(); streamWriter.Dispose(); } catch (Exception ex) { ErrorLogger.WriteToEventLog("Error while writing AppDomain Exception log!", EventLogEntryType.Error); ErrorLogger.DumpToEventLog(ex); } finally { FCMessageBox.Show("Network Error", "Received network error---please restart Streaming Video Desktop [code 2]"); Application.Exit(); } }
private void presets_AddPreset(object sender, EventArgs e) { try { MicrowaveTuningPreset item = client.SavePreset() as MicrowaveTuningPreset; if (item != null) { UserPresetItemView view = new UserPresetItemView(); view.Preset = item; view.Image = StreamViewerControl.GetSnapshot(); presets.Add(view); } } catch (Exception ex) { FCMessageBox.Show(@"Can't add preset!", "There was an error fetching the preset from the server.", this); ErrorLogger.DumpToDebug(ex); } }
private void B_RefreshSources_Click(object sender, EventArgs e) { if (ServerAddress != "") { try { ServerConfig server = new ServerConfig(ServerAddress); ServerInfo info = server.GetServerInfo(); cbNetworkSources.Items.Clear(); foreach (StreamSourceInfo i in info.StreamSources.Items) { if ((i.SourceType == SourceType.WinTV150) || (i.SourceType == SourceType.WinTV418) || (i.SourceType == SourceType.WinTV500) || (i.SourceType == SourceType.WinTV418ATSC) || (i.SourceType == SourceType.LogicalGroup)) { cbNetworkSources.Items.Add(i.SourceName); } } if (cbNetworkSources.Items.Count == 0) { FCMessageBox.Show("Server has no TV Sources", "The server you entered does not have any TV sources. Try a different server."); } else { cbNetworkSources.DropDownStyle = ComboBoxStyle.DropDownList; cbNetworkSources.DroppedDown = true; } } catch (Exception ex) { FCMessageBox.Show("Could not contact server", ex.Message); } } else { FCMessageBox.Show("Invalid IP Address", "The IP address you have entered for the Network TV server is invalid. Please correct it before you attempt to get source information."); } }
private void tuner_FrequencyChanged(object sender, EventArgs e) { try { if (client != null) { MicrowaveTuning newTune = new MicrowaveTuning(client.Capabilities.AutoTuning); newTune.Frequency = tuner.Frequency; if (keyInput.SelectedEncryption != null) { newTune.Encryption = keyInput.SelectedEncryption; } client.SetTuning(newTune); } } catch (Exception ex) { FCMessageBox.Show("Error setting frequency!", @"There was an error while setting the receiver's frequency on the server.", this); ErrorLogger.DumpToDebug(ex); } }
private void StreamViewer_StartControl(object sender, SourceControlTypeEventArgs e) { StreamViewerControl svc = sender as StreamViewerControl; if (svc == null) { return; } IControlPalette p = null; switch (e.ControlType) { case SourceControlTypes.PTZ: p = new PTZPalette(); break; case SourceControlTypes.Microwave: p = new MicrowavePalette(); break; default: return; } svc.Active = true; p.StreamViewerControl = svc; if (!PaletteWorker.IsBusy) { PaletteWorker.RunWorkerAsync(p); } else { FCMessageBox.Show("Please wait", "Another peripheral control is in the process of starting." + Environment.NewLine + "Please wait for it to finish.", this); svc.ControlState[e.ControlType] = SourceControlTypeState.Inactive; } }
/// <summary> /// Implements manual adding of servers /// </summary> private void CM_TreeViewMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { try { ToolStripItem item = e.ClickedItem; // if (item.Text == "Add Remote") // { // GetIP getIP = new GetIP(); // if (getIP.ShowDialog() == DialogResult.OK) // { // queryDaemon.AddServerManually(getIP.IP); // } // } // else if (item.Text == "Add Local") // { // queryDaemon.AddServerManually("127.0.0.1"); // } } catch (Exception ex) { FCMessageBox.Show(@"Can't add server", ex.Message); } }
private void AdvancedSettings_Load(object sender, EventArgs e) { try { VideoInputDeviceList devices = new VideoInputDeviceList(); Tuners = devices.Items; } catch (Exception ex) { FCMessageBox.Show("Error loading DeviceConfig.xml!", "There was an error loading DeviceConfig.xml. Please check the validity of the file." + Environment.NewLine + Environment.NewLine + ex.ToString(), this); } this.AutoSnapInterval = AppUser.Current.SnapshotInterval; this.AutoSnapMaximum = AppUser.Current.SnapshotMaximum; this.TunerInputType = AppUser.Current.TunerInputType; this.TunerName = AppUser.Current.TunerDeviceName; this.ServerAddress = AppUser.Current.ServerAddress; this.ServerSource = AppUser.Current.ServerSourceName; this.cbSourceType.SelectedItem = AppUser.Current.TVSource.ToString(); this.cbInputMode.SelectedItem = AppUser.Current.TVMode.ToString(); CHK_ShowNetwork.Checked = !string.IsNullOrEmpty(this.ServerAddress); CHK_ShowNetwork_CheckedChanged(this, null); }
void paletteWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (this.InvokeRequired) { this.Invoke(new RunWorkerCompletedEventHandler(paletteWorker_RunWorkerCompleted), sender, e); return; } try { if (e.Error != null) { throw e.Error; } IControlPalette p = e.Result as IControlPalette; if (p != null) { CurrentPalette = p; if (p.StreamViewerControl.FullScreen) { Stream_FullScreenClicked(p.StreamViewerControl, new EventArgs()); } p.StreamViewerControl.Active = true; p.Closed += new EventHandler <SourceControlTypeEventArgs>(StreamViewer_StopControl); p.StreamViewerControl.ControlState[p.ControlType] = SourceControlTypeState.Active; } else { //try to unwind the error, but if it gets crazy, just throw it out object[] errorResult = (object[])e.Result; if (errorResult != null) { if (errorResult.Length == 2) { Exception error = (Exception)errorResult[0]; p = (IControlPalette)errorResult[1]; p.StreamViewerControl.ControlState[p.ControlType] = SourceControlTypeState.Inactive; string msg = error.Message; //get fault specific message if available string fcMsg = (error.InnerException != null) ? error.InnerException.GetFaultInnerDetailMessage() : ""; if (!string.IsNullOrEmpty(fcMsg)) { msg += Environment.NewLine + Environment.NewLine + fcMsg; } msg += Environment.NewLine + Environment.NewLine + "Message from:" + Environment.NewLine + p.StreamViewerControl.CurrentConnection.GetDescription(); FCMessageBox.Show("Cannot access " + p.ControlType.ToString() + " control", msg, this); ErrorLogger.DumpToDebug(error); } } } } catch (Exception ex) //something terrible has happened... { FCMessageBox.Show("Cannot access control", ex.Message, this); ErrorLogger.DumpToDebug(ex); } }
private void client_PropertyChanged(object sender, PropertyChangedEventArgs e) { //if no window handle has been created, we should just queue this change instead of executing it // because that means that InvokeRequired will not return the proper value, and we will execute // the resulting code on a non-GUI thread, causing dead lock // Mantis: 1518 if (!windowHandleCreated) { pendingPropertyChanges.Enqueue(e.PropertyName); return; } if (this.InvokeRequired) { this.BeginInvoke(new PropertyChangedEventHandler(client_PropertyChanged), new object[] { sender, e }); return; } ChangingSelfValues = true; if (client != null) { switch (e.PropertyName) { case "CurrentPanAngle": ptzControl.PanAngle = client.CurrentPanAngle; break; case "CurrentTiltAngle": ptzControl.TiltAngle = client.CurrentTiltAngle; break; case "CurrentZoomPosition": ptzControl.ZoomLevel = client.CurrentZoomPosition; UpdatePTZOverlay(); break; case "EmitterEnabled": SetFCClickButtonEnabled(B_Emitter, client.EmitterEnabled); break; case "StabilizerEnabled": SetFCClickButtonEnabled(B_Stabilizer, client.StabilizerEnabled); break; case "InfraredEnabled": SetFCClickButtonEnabled(B_Infrared, client.InfraredEnabled); break; case "InvertedEnabled": SetFCClickButtonEnabled(B_Invert, client.InvertedEnabled); break; case "WiperEnabled": SetFCClickButtonEnabled(B_Wiper, client.WiperEnabled); break; case "PresetItems": try { Debug.WriteLine("SVDMain camctl PropertyChanged PresetItems"); Debug.WriteLine("PresetItems.count = " + client.PresetItems.Count); ptzFavoritesControl.UpdateItems(client.PresetItems); } catch (Exception exc) { ErrorLogger.DumpToDebug(exc); } break; case "StatusMessage": FCMessageBox.Show("Camera Control Notification", client.StatusMessage, this); break; } } ChangingSelfValues = false; }