public static DscDebugger GetInstance(MulticastCommandServer cmdSrv, CommandDispatcher dispatcher) { lock (padlock) { if (instance == null || instance.IsDisposed) { instance = new DscDebugger(cmdSrv, dispatcher); } return instance; } }
public ICM411() { string uid = Guid.NewGuid().ToString(); rtp = new RtpAudioFacade(ConfSingleton.Instance.Network); try { cmdSrv = new MulticastCommandServer(uid); } catch (Exception ex) { MessageBox.Show(ex.Message, "Unable to start command server", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } cmdDispatcher = new CommandDispatcher(uid); aisReg = new AISRegistry(cmdSrv); outgoingDistress = new OutgoingDistress(rtp); groupAddresses = new AddressRecordCollection(); indvAddresses = new AddressRecordCollection(); deferredChanChangeTimer = new Timer(); deferredChanChangeTimer.Interval = 1000; deferredChanChangeTimer.Enabled = false; deferredChanChangeTimer.Tick += new EventHandler(deferredChanChangeTimer_Tick); dscEnvelope = new DscEnvelope(); outgoingDistress.DistressEnded += new EventHandler(outgoingDistress_DistressEnded); outgoingDistress.DistressStarted += new EventHandler(outgoingDistress_DistressStarted); outgoingDistress.TimeToSendDistress += new EventHandler<TimeToSendDistressEventArgs>(outgoingDistress_TimeToSendDistress); InitializeComponent(); try { rtp.SetVoiceDevices(this); } catch (Exception) { //MessageBox.Show(String.Format("Unable to initialise sound hardware. This may be because there isn't a physical output device present.{0}{1}", Environment.NewLine + Environment.NewLine, e.InnerException != null ? e.InnerException.Message : e.Message), "DirectSound error", MessageBoxButtons.OK, MessageBoxIcon.Error); notifyIcon.ShowBalloonTip(4000, "Unable to initialise sound hardware", "This may be because there is no physical output device connected.", ToolTipIcon.Error); } }
private DscDebugger(MulticastCommandServer cmdSrv, CommandDispatcher dispatcher) { this.cmdSrv = cmdSrv; this.dispatcher = dispatcher; InitializeComponent(); }