public void RaiseVoidEvent(VoidEventHandler @event) { if (@event != null) { @event(); } }
/// <summary> /// Initializes a new instance of PluginManager /// </summary> public PluginManager() { this.plugins = new SortedList <string, Plugin>(); this.pluginTypeName = typeof(Plugin).Name; this.rwPluginsLock = new ReaderWriterLock(); this.lockObject = new Object(); this.startPluginsCallback = new VoidEventHandler(this.StartPlugins); this.stopPluginsCallback = new VoidEventHandler(this.StopPlugins); }
public Form1() { InitializeComponent(); dlgClearAll = new VoidEventHandler(ClearAll); dlgFillBlackboardData = new VoidEventHandler(FillBlackboardData); modules = new SortedList<string, ModuleClient>(); prototypes = new SortedList<string, Prototype>(); ConfigurationHelper.Blackboard = null; }
public Form1() { InitializeComponent(); dlgClearAll = new VoidEventHandler(ClearAll); dlgFillBlackboardData = new VoidEventHandler(FillBlackboardData); modules = new SortedList <string, ModuleClient>(); prototypes = new SortedList <string, Prototype>(); ConfigurationHelper.Blackboard = null; }
//--------------------------------------------------------------- #endregion //--------------------------------------------------------------- //--------------------------------------------------------------- #region Methods //--------------------------------------------------------------- /// <summary> /// Initializes the engine with a given application object. /// </summary> /// <param name="application">game to start</param> public void Connect(IApplication application) { OnInit = null; OnRender = null; OnClose = null; // connect event handlers OnInit += new VoidEventHandler(application.OnInit); OnRender += new RenderEventHandler(application.OnRender); OnClose += new VoidEventHandler(application.OnClose); }
//private Prototype selectedPrototype; #endregion #region Constructor public FrmConfigUtil() { InitializeComponent(); dlgClearAll = new VoidEventHandler(ClearAll); dlgFillBlackboardData = new VoidEventHandler(FillBlackboardData); dlgFillModuleData = new VoidEventHandler(FillModuleData); dlgFillVariableData = new VoidEventHandler(FillVariableData); dlgClearModule = new VoidEventHandler(ClearModule); dlgClearVariable = new VoidEventHandler(ClearVariable); modules = new SortedList <string, Module>(); prototypes = new SortedList <string, Prototype>(); this.configurationHelper = new ConfigurationHelper(); ConfigurationHelper.Blackboard = null; }
// This is called when an update completes private void UpdateComplete() { if (this.InvokeRequired) { VoidEventHandler d = new VoidEventHandler(UpdateComplete); this.BeginInvoke(d); } else { if (updatefailed) { failbutton.Text = "Scan Failed"; failbutton.StartWarningFlash(); incomingbutton.Text = "N / A"; incomingbutton.StopWarningFlash(); clearbutton.Text = "N / A"; clearbutton.StopInfoFlash(); } else { failbutton.Text = "Scan OK"; failbutton.StopWarningFlash(); incomingbutton.Text = incomingtext; if (flashincoming) { incomingbutton.StartWarningFlash(); } else { incomingbutton.StopWarningFlash(); } clearbutton.Text = cleartext; if (flashclear) { clearbutton.StartInfoFlash(); } else { clearbutton.StopInfoFlash(); } } // Start timer for next update updatetimer.Interval = nextupdatedelay; updatetimer.Start(); } }
// This is called when an update completes private void UpdateComplete() { if (this.InvokeRequired) { VoidEventHandler d = new VoidEventHandler(UpdateComplete); this.BeginInvoke(d); } else { try { // Size label, totally useless, purely decorative float xmllen = (float)xml.InnerText.Length * 13.117f; sizelabel.Text = xmllen.ToString("0 . 000 B"); // Received as "Dordrecht - 15:34" string titletext = xml.DocumentElement.FirstChild.InnerText; // Determine current time plus walk time to compare with int lastspace = titletext.TrimEnd().LastIndexOf(' '); int separator = titletext.IndexOf(':'); string hourstr = titletext.Substring(lastspace + 1, separator - lastspace - 1); string minutestr = titletext.Substring(separator + 1).TrimEnd(); int hourint = int.Parse(hourstr); int minuteint = int.Parse(minutestr); DateTime statstime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hourint, minuteint, 1); statstime = statstime.AddMinutes(WALK_MINUTES); titlelabel.Text = hourstr + ":" + minuteint.ToString("00"); // Move to the first <tr> element for the first item XmlNode xmlitem = xml.DocumentElement.FirstChild.NextSibling; xmlitem = xmlitem.NextSibling.NextSibling.NextSibling.FirstChild.NextSibling.FirstChild; // Setup the items on screen using the XML data for (int i = 0; i < items.GetLength(0); i++) { if (xmlitem != null) { string warning = ""; bool warningserious = false; // Show all cells in normal state for (int c = 0; c < items.GetLength(1); c++) { items[i, c].StopInfoFlash(); items[i, c].StopWarningFlash(); } // Time and delay (received in a format like "16:45 + 2 min.") string xmltime = xmlitem.FirstChild.InnerText.Trim(); int pluspos = xmltime.IndexOf('+'); string timeonly = xmltime; string delayonly = ""; if (pluspos > -1) { timeonly = timeonly.Substring(0, pluspos - 1); int minpos = xmltime.IndexOf("min."); delayonly = xmltime.Substring(pluspos, (minpos - pluspos) - 1); items[i, 1].StartWarningFlash(); } items[i, 0].Text = timeonly; items[i, 1].Text = delayonly; items[i, 0].Visible = true; items[i, 1].Visible = true; // Determine time for comparison int firstspace = xmltime.IndexOf(' '); if (firstspace == -1) { firstspace = xmltime.Length; } separator = xmltime.IndexOf(':'); hourstr = xmltime.Substring(0, separator); minutestr = xmltime.Substring(separator + 1, firstspace - separator - 1); hourint = int.Parse(hourstr); minuteint = int.Parse(minutestr); DateTime itemtime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hourint, minuteint, 0); if (itemtime.Ticks < statstime.Ticks) { items[i, 0].StartInfoFlash(); } // Direction string direction = xmlitem.FirstChild.NextSibling.InnerText; items[i, 2].Text = direction.Trim(); items[i, 2].Visible = true; // Spoor XmlNode spoorxml = xmlitem.FirstChild.NextSibling.NextSibling; items[i, 3].Text = spoorxml.InnerText.Trim(); items[i, 3].Visible = true; XmlNode spoorclassxml = spoorxml.Attributes.GetNamedItem("class"); if (spoorclassxml != null) { items[i, 3].StartWarningFlash(); } // Type (try finding a warning in here as well) XmlNode typexml = xmlitem.FirstChild.NextSibling.NextSibling.NextSibling.NextSibling; string type = typexml.InnerText.TrimStart(); int spacepos = type.IndexOf(' '); if (spacepos > -1) { string beforespace = type.Substring(0, spacepos).Trim(); // In case of "Rijdt vandaag niet" there is no train type if (string.Compare(beforespace, "Rijdt", true) == 0) { spacepos = 0; beforespace = "N/A"; warningserious = true; // Make the entire row flash for (int c = 0; c < items.GetLength(1); c++) { items[i, c].StartWarningFlash(); } } string afterspace = type.Substring(spacepos).Trim(); type = Tools.StripExcessiveWhitespace(beforespace.Replace(",", "")); if (afterspace.Length > 0) { afterspace = afterspace.TrimStart(','); warning = Tools.StripExcessiveWhitespace(afterspace.Trim()); // If the site indicates the text in red, so do we (exceptions below) warningserious = (typexml.FirstChild.NextSibling != null) && (typexml.FirstChild.NextSibling.Name == "span"); if (warning.StartsWith("extra", StringComparison.InvariantCultureIgnoreCase)) { warningserious = false; } } } items[i, 4].Text = type.Trim(); items[i, 4].Visible = true; // Determine row color ColorIndex rowcolor = ColorIndex.ControlNormal; if (type.StartsWith("Sneltrein")) { rowcolor = ColorIndex.ControlColor3; } else if (type.StartsWith("Stoptrein")) { rowcolor = ColorIndex.ControlColor4; } else if (type.StartsWith("Sprinter")) { rowcolor = ColorIndex.ControlColor4; } // Give the entire row a color for (int c = 0; c < items.GetLength(1); c++) { items[i, c].ColorNormal = rowcolor; items[i, c].SetupColors(General.Colors); } // Any warning to show? if (warning.Length > 0) { Font f; if (warning.Length < 20) { f = items[i, 4].Font; } else { f = smallfontexample.Font; } items[i, 5].Font = f; items[i, 5].Text = warning; if (warningserious) { items[i, 5].StartWarningFlash(); } else { items[i, 5].StartInfoFlash(); } items[i, 5].Visible = true; } else { items[i, 5].Visible = false; } // Move to the next <tr> element xmlitem = xmlitem.NextSibling; } else { // No more items, so hide these cells for (int c = 0; c < items.GetLength(1); c++) { items[i, c].StopInfoFlash(); items[i, c].StopWarningFlash(); items[i, c].Visible = false; } } } } catch (Exception e) { HandleFail("Failed to update treintijden. " + e.GetType().Name + ": " + e.Message); } // Start timer for next update updatetimer.Interval = nextupdatedelay; updatetimer.Start(); } }
/// <summary> /// Initializes a new instance of CtrlSettingsPannel /// </summary> public CtrlSettingsPannel() { InitializeComponent(); dlgUpdateSettings = new VoidEventHandler(UpdateSettings); gbFeaturesExtraction.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom; }
// This is called when an update completes private void UpdateComplete() { if(this.InvokeRequired) { VoidEventHandler d = new VoidEventHandler(UpdateComplete); this.BeginInvoke(d); } else { try { // Size label, totally useless, purely decorative float xmllen = (float)xml.InnerText.Length * 13.117f; sizelabel.Text = xmllen.ToString("0 . 000 B"); // Received as "Dordrecht - 15:34" string titletext = xml.DocumentElement.FirstChild.InnerText; // Determine current time plus walk time to compare with int lastspace = titletext.TrimEnd().LastIndexOf(' '); int separator = titletext.IndexOf(':'); string hourstr = titletext.Substring(lastspace + 1, separator - lastspace - 1); string minutestr = titletext.Substring(separator + 1).TrimEnd(); int hourint = int.Parse(hourstr); int minuteint = int.Parse(minutestr); DateTime statstime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hourint, minuteint, 1); statstime = statstime.AddMinutes(WALK_MINUTES); titlelabel.Text = hourstr + ":" + minuteint.ToString("00"); // Move to the first <tr> element for the first item XmlNode xmlitem = xml.DocumentElement.FirstChild.NextSibling; xmlitem = xmlitem.NextSibling.NextSibling.NextSibling.FirstChild.NextSibling.FirstChild; // Setup the items on screen using the XML data for(int i = 0; i < items.GetLength(0); i++) { if(xmlitem != null) { string warning = ""; bool warningserious = false; // Show all cells in normal state for(int c = 0; c < items.GetLength(1); c++) { items[i, c].StopInfoFlash(); items[i, c].StopWarningFlash(); } // Time and delay (received in a format like "16:45 + 2 min.") string xmltime = xmlitem.FirstChild.InnerText.Trim(); int pluspos = xmltime.IndexOf('+'); string timeonly = xmltime; string delayonly = ""; if(pluspos > -1) { timeonly = timeonly.Substring(0, pluspos - 1); int minpos = xmltime.IndexOf("min."); delayonly = xmltime.Substring(pluspos, (minpos - pluspos) - 1); items[i, 1].StartWarningFlash(); } items[i, 0].Text = timeonly; items[i, 1].Text = delayonly; items[i, 0].Visible = true; items[i, 1].Visible = true; // Determine time for comparison int firstspace = xmltime.IndexOf(' '); if(firstspace == -1) firstspace = xmltime.Length; separator = xmltime.IndexOf(':'); hourstr = xmltime.Substring(0, separator); minutestr = xmltime.Substring(separator + 1, firstspace - separator - 1); hourint = int.Parse(hourstr); minuteint = int.Parse(minutestr); DateTime itemtime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hourint, minuteint, 0); if(itemtime.Ticks < statstime.Ticks) items[i, 0].StartInfoFlash(); // Direction string direction = xmlitem.FirstChild.NextSibling.InnerText; items[i, 2].Text = direction.Trim(); items[i, 2].Visible = true; // Spoor XmlNode spoorxml = xmlitem.FirstChild.NextSibling.NextSibling; items[i, 3].Text = spoorxml.InnerText.Trim(); items[i, 3].Visible = true; XmlNode spoorclassxml = spoorxml.Attributes.GetNamedItem("class"); if(spoorclassxml != null) items[i, 3].StartWarningFlash(); // Type (try finding a warning in here as well) XmlNode typexml = xmlitem.FirstChild.NextSibling.NextSibling.NextSibling.NextSibling; string type = typexml.InnerText.TrimStart(); int spacepos = type.IndexOf(' '); if(spacepos > -1) { string beforespace = type.Substring(0, spacepos).Trim(); // In case of "Rijdt vandaag niet" there is no train type if(string.Compare(beforespace, "Rijdt", true) == 0) { spacepos = 0; beforespace = "N/A"; warningserious = true; // Make the entire row flash for(int c = 0; c < items.GetLength(1); c++) items[i, c].StartWarningFlash(); } string afterspace = type.Substring(spacepos).Trim(); type = Tools.StripExcessiveWhitespace(beforespace.Replace(",", "")); if(afterspace.Length > 0) { afterspace = afterspace.TrimStart(','); warning = Tools.StripExcessiveWhitespace(afterspace.Trim()); // If the site indicates the text in red, so do we (exceptions below) warningserious = (typexml.FirstChild.NextSibling != null) && (typexml.FirstChild.NextSibling.Name == "span"); if(warning.StartsWith("extra", StringComparison.InvariantCultureIgnoreCase)) warningserious = false; } } items[i, 4].Text = type.Trim(); items[i, 4].Visible = true; // Determine row color ColorIndex rowcolor = ColorIndex.ControlNormal; if(type.StartsWith("Sneltrein")) rowcolor = ColorIndex.ControlColor3; else if(type.StartsWith("Stoptrein")) rowcolor = ColorIndex.ControlColor4; else if(type.StartsWith("Sprinter")) rowcolor = ColorIndex.ControlColor4; // Give the entire row a color for(int c = 0; c < items.GetLength(1); c++) { items[i, c].ColorNormal = rowcolor; items[i, c].SetupColors(General.Colors); } // Any warning to show? if(warning.Length > 0) { Font f; if(warning.Length < 20) f = items[i, 4].Font; else f = smallfontexample.Font; items[i, 5].Font = f; items[i, 5].Text = warning; if(warningserious) items[i, 5].StartWarningFlash(); else items[i, 5].StartInfoFlash(); items[i, 5].Visible = true; } else { items[i, 5].Visible = false; } // Move to the next <tr> element xmlitem = xmlitem.NextSibling; } else { // No more items, so hide these cells for(int c = 0; c < items.GetLength(1); c++) { items[i, c].StopInfoFlash(); items[i, c].StopWarningFlash(); items[i, c].Visible = false; } } } } catch(Exception e) { HandleFail("Failed to update treintijden. " + e.GetType().Name + ": " + e.Message); } // Start timer for next update updatetimer.Interval = nextupdatedelay; updatetimer.Start(); } }
private void SetupEventHandlers() { this.FormClosing += new FormClosingEventHandler(FrmRecoHuman_FormClosing); dlgUpdateControlCameras = new VoidEventHandler(UpdateControlCameras); dlgListCameras = new VoidEventHandler(ListCameras); dlgUpdateSettings = new VoidEventHandler(UpdateSettings); dlgUpdateVideoControls = new VoidEventHandler(UpdateVideoControls); dlgRecognitionResultUpdate = new VideoControlUpdateEH(RecognitionResultUpdate); dlgRecognitionResultUpdate2 = new VideoControlUpdate2EH(RecognitionResultUpdate); dlgRecognitionResultUpdate3 = new VideoControlUpdate3EH(RecognitionResultUpdate); dlgRecognitionResultUpdate4 = new VideoControlUpdate4EH(RecognitionResultUpdate); dlgShowRecognitionResults = new ShowRecognitionResultsEH(ShowRecognitionResults); dlgShowDetectionResults = new ShowDetectionResultsEH(ShowDetectionResults); dlgUpdateKnownFacesPanel = new VoidEventHandler(UpdateKnownFacesPanel); dlgShowVLComponentsStatus = new VoidEventHandler(ShowVLComponentsStatus); dlgCloseRequest = new VoidEventHandler(CloseRequest); updateConsoleEH = new StringEventHandler(Console); }
/// <summary> /// Initializes a new instance of FrmSocketSpeech /// </summary> public FrmSocketSpeech() { x64 = IntPtr.Size == 8; InitializeComponent(); //if (x64 && Loq7SpeechGenerator.LoquendoInstalled) //if (Loq7SpeechGenerator.LoquendoInstalled) // spGen = new Loq7SpeechGenerator(); //else spGen = new SapiSpeechGenerator(); spGen.SpeakStarted += new SpeakStartedEventHandler(spGen_SpeakStarted); spGen.SpeakCompleted += new SpeakCompletedEventHandler(spGen_SpeakCompleted); spGen.VoiceChanged += new VoiceChangedEventHandler(spGen_VoiceChanged); spGen.SpeakProgress += new SpeakProgressEventHandler(spGen_SpeakProgress); //if(!x64) audioPlayer = new AudioPlayer32(); //else // audioPlayer = new AudioPlayer64(); TcpPortIn = 2052; TcpPortOut = 2052; TcpServerAddress = System.Net.IPAddress.Parse("127.0.0.1"); commandManager = new PacItoCommandManager(); commandManager.SharedVariablesLoaded += new SharedVariablesLoadedEventHandler(commandManager_SharedVariablesLoaded); commandManager.Started += new CommandManagerStatusChangedEventHandler(commandManager_Started); commandManager.Stopped += new CommandManagerStatusChangedEventHandler(commandManager_Stopped); connectionManager = new ConnectionManager(2052, commandManager); connectionManager.ClientConnected += new TcpClientConnectedEventHandler(connectionManager_ClientConnected); connectionManager.ClientDisconnected += new TcpClientDisconnectedEventHandler(connectionManager_ClientDisconnected); connectionManager.Connected += new TcpClientConnectedEventHandler(connectionManager_Connected); //connectionManager.DataReceived += new ConnectionManagerDataReceivedEH(connectionManager_DataReceived); connectionManager.Disconnected += new TcpClientDisconnectedEventHandler(connectionManager_Disconnected); cexAread = new SpgAreadCommandExecuter(spGen); cexAsay = new SpgAsayCommandExecuter(spGen); cexRead = new SpgReadCommandExecuter(spGen); cexSay = new SpgSayCommandExecuter(spGen); cexShutUp = new SpgShutUpCommandExecuter(spGen, audioPlayer); cexVoice = new SpgVoiceCommandExecuter(spGen); cexAplay = new SpgAplayCommandExecuter(audioPlayer); cexPlay = new SpgPlayCommandExecuter(audioPlayer); cexPlayLoop = new SpgPlayLoopCommandExecuter(audioPlayer); cexReadCompatible = new SpgReadCommandExecuter("read", spGen); cexSayCompatible = new SpgAsayCommandExecuter("say", spGen); commandManager.CommandExecuters.Add(cexAread); commandManager.CommandExecuters.Add(cexAsay); commandManager.CommandExecuters.Add(cexRead); commandManager.CommandExecuters.Add(cexSay); commandManager.CommandExecuters.Add(cexShutUp); commandManager.CommandExecuters.Add(cexVoice); commandManager.CommandExecuters.Add(cexAplay); commandManager.CommandExecuters.Add(cexPlay); commandManager.CommandExecuters.Add(cexPlayLoop); commandManager.CommandExecuters.Add(cexSayCompatible); commandManager.CommandExecuters.Add(cexReadCompatible); dlgConsole = new StringEventHandler(Console); dlgUpdateVoiceCombo = new VoidEventHandler(UpdateVoiceCombo); dlgSetTextboxText = new SetTextboxTextCallback(SetTextboxText); dlgAppendTextboxText = new SetTextboxTextCallback(AppendTextboxText); dlgUpdatePB = new DoubleEventHandler(UpdateProgressBar); AutoDisableSpRec = false; }
//--------------------------------------------------------------- #endregion //--------------------------------------------------------------- //--------------------------------------------------------------- #region Initialisation //--------------------------------------------------------------- /// <summary> /// Crates an instance of a <see cref="DelegateEntity"/>. /// </summary> public DelegateEntity(VoidEventHandler eventHandler) { OnTraverse += eventHandler; }
public void RaiseVoidEvent(VoidEventHandler @event) { throw new NotImplementedException(); }
public FrmBlackboard() { InitializeComponent(); frmBbss = new FrmBlackboardSecondaryScreen(this); this.scTop.Panel2MinSize = 257; SetupShutdownModeControls(); SetupStartupModeControls(); //TextBoxStreamWriter tbsw = new TextBoxStreamWriter(txtOutputLog); //tbsw.AppendDate = true; //log = new LogWriter(tbsw); moduleButtons = new SortedList<string, Button>(); moduleButtonsClone = new SortedList<string, Button>(); frmBbss.GbBlackboardFiles.Enabled = gbBlackboardFiles.Enabled = true; gbBlackboardSettings.Enabled = false; frmBbss.GbModuleList.Enabled = gbModuleList.Enabled = false; btnStartStop.Enabled = false; frmBbss.BtnStartStop.Enabled = false; this.Icon = Properties.Resources.star2_48; updateModuleInfo = new VoidEventHandler(UpdateModuleInfo); rmsList = new Dictionary<IPAddress, MachineStatusControl>(); tcLog.SelectedTab = tpOutputLog; this.chkAutoLog.Checked = true; dlgMslMachineStatusAdded = new MachineStatusAddRemoveEH(MachineStatusList_MachineStatusAdded); dlgMslMachineStatusRemoved = new MachineStatusAddRemoveEH(MachineStatusList_MachineStatusRemoved); dlgMslMachineStatusChanged = new MachineStatusElementChangedEH(MachineStatusList_ElementChanged); dlgBbStatusChanged = new VoidEventHandler(bbStatusChanged); dlgModuleStatusChanged = new StatusChangedEH(module_StatusChanged); dlgShvSharedVariableAdded = new SharedVariableAddedEventHandler(SharedVariables_SharedVariableAdded); dlgSetupBlackboardModule = new IModuleAddRemoveEH(SetupBlackboardModule); #if !SPEED_UP this.redirectionHistoryColumn = lvwRedirectionHistory.Columns.IndexOf(chCommandSent); dispatchedCommands = new List<ITextCommand>(10000); dlgBlackboardResponseRedirected = new ResponseRedirectedEH(blackboard_ResponseRedirected); dlgAddRedirectionListItem = new AddRedirectionListItemEH(AddRedirectionListItem); #else tcLog.TabPages.Remove(tpMessagePendingList); tcLog.TabPages.Remove(tpRedirectionHistory); #endif }
// This is called when an update completes private void UpdateComplete() { if(this.InvokeRequired) { VoidEventHandler d = new VoidEventHandler(UpdateComplete); this.BeginInvoke(d); } else { if(updatefailed) { failbutton.Text = "Scan Failed"; failbutton.StartWarningFlash(); incomingbutton.Text = "N / A"; incomingbutton.StopWarningFlash(); clearbutton.Text = "N / A"; clearbutton.StopInfoFlash(); } else { failbutton.Text = "Scan OK"; failbutton.StopWarningFlash(); incomingbutton.Text = incomingtext; if(flashincoming) incomingbutton.StartWarningFlash(); else incomingbutton.StopWarningFlash(); clearbutton.Text = cleartext; if(flashclear) clearbutton.StartInfoFlash(); else clearbutton.StopInfoFlash(); } // Start timer for next update updatetimer.Interval = nextupdatedelay; updatetimer.Start(); } }