//[UserConfigurableProperty("Data")] //public string Data { get; set; } public SignalCreator(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Resend", (Action<dynamic>)(s => Resend())); protocolControls = new List<Control>(); inputProtocolControls = new List<Control>(); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("ThumbnailImage"); AddEmitProtocol("SystemShowImage"); AddEmitProtocol("ViewImage", false); AddEmitProtocol("GetImageMetadata", false); }
public FeedReader(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("RSSFeedUrl", (Action <dynamic>)(s => ProcessUrl(s))); AddEmitProtocol("RSSFeedItem"); AddEmitProtocol("Exception"); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Zip5"); // We can receive a zipcode from some external source. AddEmitProtocol("Zip5"); // We also emit a zipcode because we may be configured to process a zipcode on startup, in which case we need to initiate getting the city, state. AddEmitProtocol("WeatherInfo"); AddEmitProtocol("ExceptionMessage"); }
public ImageViewer(IReceptorSystem rsys) : base("ImageViewer.xml", true, rsys) { /* AddReceiveProtocol("ImageFilename", (Action<dynamic>)(signal => { form.IfNull(() => InitializeViewer()); // TODO: As remarked in VisualizerController, we need computed types that can perform this kind of function for us when we use a getter like "FullyQualifiedFilename" Image img = Image.FromFile(Path.Combine(signal.Filename.Path.Value, signal.Filename.Name.Value + signal.Filename.FileExtension.Value)); MakeWindowFitImage(img); pb.Image = img; })); */ AddEmitProtocol("Url"); AddReceiveProtocol("Image", (Action<dynamic>)(signal => { form.IfNull(() => { InitializeUI(); form.FormClosing += WhenFormClosing; form.SizeChanged += ProportionalResize; }); pb.Image = signal.Value; string title = signal.Title.Text.Value; if (!String.IsNullOrEmpty(title)) { WindowName = title; UpdateCaption(); } })); }
public FeedItemList(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("URL"); AddEmitProtocol("DropView"); AddEmitProtocol("RequireView"); AddEmitProtocol("DatabaseRecord"); AddReceiveProtocol("RSSFeedItemDisplay", // cast is required to resolve Func vs. Action in parameter list. (Action <dynamic>)(signal => AddFeedItem(signal))); AddReceiveProtocol("Recordset", signal => signal.Schema == "FeedItemPhrases", signal => ProcessFeedItems(signal)); AddReceiveProtocol("Recordset", signal => signal.Schema == "RSSFeedItemDisplay", signal => ProcessFeedItems(signal)); AddReceiveProtocol("SearchDateRange", (Action <dynamic>)(signal => { SearchDateRange(signal.BeginningDate, signal.EndingDate); })); InitializeViewer(); }
/// <summary> /// Instantiate the receptor from the pre-loaded assembly. /// The receptor system instance is passed to the constructor if the IReceptorInstance implementor. /// </summary> public Receptor Instantiate(IReceptorSystem rsys) { Type impType; try { impType = assembly.GetTypes(). Where(t => t.IsClass). Where(c => c.GetInterfaces().Where(i => i.Name == "IReceptorInstance").Count() > 0).Single(); } catch { throw new ApplicationException("Unable to locate the receptor assembly " + assemblyName); } try { Instance = Activator.CreateInstance(impType, new object[] { rsys }) as IReceptorInstance; Name = Instance.Name; Instance.Enabled = Enabled; } catch (Exception ex) // Need to be able to see originating exception. { throw new ApplicationException("Unable to instantiate the receptor " + Name + "\r\n" + ex.Message); } Instantiated = true; return(this); }
public CarrierTabbedListViewer(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("ExceptionMessage"); protocolTabPageMap = new Dictionary <string, TabPage>(); protocolGridMap = new Dictionary <string, DataGridView>(); }
public ImageViewer(IReceptorSystem rsys) : base("ImageViewer.xml", true, rsys) { /* * AddReceiveProtocol("ImageFilename", (Action<dynamic>)(signal => * { * form.IfNull(() => InitializeViewer()); * // TODO: As remarked in VisualizerController, we need computed types that can perform this kind of function for us when we use a getter like "FullyQualifiedFilename" * Image img = Image.FromFile(Path.Combine(signal.Filename.Path.Value, signal.Filename.Name.Value + signal.Filename.FileExtension.Value)); * MakeWindowFitImage(img); * pb.Image = img; * })); */ AddEmitProtocol("Url"); AddReceiveProtocol("Image", (Action <dynamic>)(signal => { form.IfNull(() => { InitializeUI(); form.FormClosing += WhenFormClosing; form.SizeChanged += ProportionalResize; }); pb.Image = signal.Value; string title = signal.Title.Text.Value; if (!String.IsNullOrEmpty(title)) { WindowName = title; UpdateCaption(); } })); }
public CarrierTabbedListViewer(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("ExceptionMessage"); protocolTabPageMap = new Dictionary<string, TabPage>(); protocolGridMap = new Dictionary<string, DataGridView>(); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Zip5"); // We can receive a zipcode from some external source. AddEmitProtocol("Zip5"); // We also emit a zipcode because we may be configured to process a zipcode on startup, in which case we need to initiate getting the city, state. AddEmitProtocol("WeatherInfo"); AddEmitProtocol("ExceptionMessage"); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("ThumbnailImage", (Action<dynamic>)(signal => ShowImage(signal.Image.Value, signal.SourceImageFilename.Filename))); AddEmitProtocol("SystemShowImage"); AddEmitProtocol("ImageFilename", false); // Currently, this is emitted by the visualizer. See TODO below. // AddEmitProtocol("GetImageMetadata", false); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("ThumbnailImage", (Action <dynamic>)(signal => ShowImage(signal.Image.Value, signal.SourceImageFilename.Filename))); AddEmitProtocol("SystemShowImage"); AddEmitProtocol("ImageFilename", false); // Currently, this is emitted by the visualizer. See TODO below. // AddEmitProtocol("GetImageMetadata", false); }
//[UserConfigurableProperty("Data")] //public string Data { get; set; } public SignalCreator(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Resend", (Action <dynamic>)(s => Resend())); protocolControls = new List <Control>(); inputProtocolControls = new List <Control>(); }
public WindowedBaseReceptor(string displayFormFilename, bool showOnStartup, IReceptorSystem rsys) : base(rsys) { this.displayFormFilename = displayFormFilename; this.showOnStartup = showOnStartup; LayoutId = Guid.NewGuid(); // will be overridden by the persisted LayoutId when the receptor system is loaded. }
public WebBrowserReceptor(IReceptorSystem rsys) : base("webPageViewer.xml", false, rsys) { Cef.Initialize(); AddReceiveProtocol("Url", (Action <dynamic>)(signal => ShowPage(signal.Value))); AddReceiveProtocol("Text", (Action <dynamic>)(signal => EmbedSearchString(signal.Value))); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { zipcodeInfoMap = new Dictionary <string, FullInfo>(); AddReceiveProtocol("WeatherInfo"); AddReceiveProtocol("Location"); AddEmitProtocol("TextToSpeech"); }
public WindowedBaseReceptor(string displayFormFilename, bool showOnStartup, IReceptorSystem rsys) : base(rsys) { this.displayFormFilename = displayFormFilename; this.showOnStartup = showOnStartup; LayoutId = Guid.NewGuid(); // will be overridden by the persisted LayoutId when the receptor system is loaded. }
public WebBrowserReceptor(IReceptorSystem rsys) : base("webPageViewer.xml", false, rsys) { Cef.Initialize(); AddReceiveProtocol("Url", (Action<dynamic>)(signal => ShowPage(signal.Value))); AddReceiveProtocol("Text", (Action<dynamic>)(signal => EmbedSearchString(signal.Value))); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { this.rsys = rsys; AddReceiveProtocol("ImageFilename"); AddEmitProtocol("DebugMessage"); AddEmitProtocol("ThumbnailImage", false); MaxSize = 320; }
public BaseReceptor(IReceptorSystem rsys) { this.rsys = rsys; receiveProtocols = new List <ReceiveQualifier>(); emitProtocols = new List <string>(); gates = new Dictionary <string, Gate>(); compositeGates = new Dictionary <string, CompositeGate>(); }
public Exceptions(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Exception", // cast is required to resolve Func vs. Action in parameter list. (Action<dynamic>)(signal => ShowException(signal))); InitializeUI(); }
public Exceptions(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Exception", // cast is required to resolve Func vs. Action in parameter list. (Action <dynamic>)(signal => ShowException(signal))); InitializeUI(); }
public DayGreeter(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("Text"); AddEmitProtocol("RSSFeedUrl"); AddReceiveProtocol("RSSFeedItem", (Action<dynamic>)(s => ProcessFeedItem(s))); groups = new Dictionary<string, StringBuilder>(); }
public FeedReader(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("RSSFeedUrl", (Action<dynamic>)(s => ProcessUrl(s))); AddReceiveProtocol("RSSFeedRefresh", (Action<dynamic>)(s => AcquireFeed(lastFeedUrl))); AddEmitProtocol("RSSFeedItem"); AddEmitProtocol("ExceptionMessage"); AddEmitProtocol("LoggerMessage"); }
int currentCaveNumber = -1; // No starting cave. public PlayerReceptor(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("HW_Player"); AddReceiveProtocol("HW_GameState"); AddEmitProtocol("HW_MoveTo"); AddEmitProtocol("HW_ShootInto"); rnd = new Random(); form = new Form(); form.Text = "Hunt The Wumpus"; form.Location = new Point(600, 100); form.Size = new Size(320, 130); form.StartPosition = FormStartPosition.Manual; moveButtons = new Button[3] { new Button(), new Button(), new Button() }; shootButtons = new Button[3] { new Button(), new Button(), new Button() }; moveButtons.ForEachWithIndex((b, idx) => { b.Visible = false; b.Location = new Point(10 + idx * 100, 15); b.Size = new Size(80, 25); b.Click += OnMove; form.Controls.Add(b); }); shootButtons.ForEachWithIndex((b, idx) => { b.Visible = false; b.Location = new Point(10 + idx * 100, 50); b.Size = new Size(80, 25); b.Click += OnShoot; form.Controls.Add(b); }); lblPlayerIsDead = new Label(); lblPlayerIsDead.Text = "You are dead!"; lblPlayerIsDead.Location = new Point(10, 15); lblPlayerIsDead.Size = new Size(300, 15); lblPlayerIsDead.TextAlign = ContentAlignment.MiddleCenter; lblPlayerIsDead.Visible = false; lblPlayerWins = new Label(); lblPlayerWins.Text = "The Wumpus is dead!"; lblPlayerWins.Location = new Point(10, 15); lblPlayerWins.Size = new Size(300, 15); lblPlayerWins.TextAlign = ContentAlignment.MiddleCenter; lblPlayerWins.Visible = false; form.Controls.Add(lblPlayerIsDead); form.Controls.Add(lblPlayerWins); form.Show(); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { zipcodeInfoMap = new Dictionary <string, FullInfo>(); AddReceiveProtocol("WeatherInfo"); AddReceiveProtocol("USLocation"); AddEmitProtocol("Announce"); AddEmitProtocol("Text"); AddEmitProtocol("ExceptionMessage"); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { zipcodeInfoMap = new Dictionary<string, FullInfo>(); AddReceiveProtocol("WeatherInfo"); AddReceiveProtocol("USLocation"); AddEmitProtocol("Announce"); AddEmitProtocol("Text"); AddEmitProtocol("ExceptionMessage"); }
public WeatherRadarScraper(IReceptorSystem rsys) : base(rsys) { // AddEmitProtocol("ImageFilename"); AddEmitProtocol("WebImage"); AddEmitProtocol("Url"); AddEmitProtocol("ExceptionMessage"); AddReceiveProtocol("WebPageHtml", (Action <dynamic>)(signal => ProcessPage(signal.Url.Value, signal.Html.Value))); AddReceiveProtocol("Refresh", (Action <dynamic>)(signal => GetRadarImage())); }
public WeatherRadarScraper(IReceptorSystem rsys) : base(rsys) { // AddEmitProtocol("ImageFilename"); AddEmitProtocol("WebImage"); AddEmitProtocol("Url"); AddEmitProtocol("ExceptionMessage"); AddReceiveProtocol("WebPageHtml", (Action<dynamic>)(signal => ProcessPage(signal.Url.Value, signal.Html.Value))); AddReceiveProtocol("Refresh", (Action<dynamic>)(signal => GetRadarImage())); }
public ThumbnailCreator(IReceptorSystem rsys) : base(rsys) { this.rsys = rsys; AddReceiveProtocol("ImageFilename", (Action <dynamic>)(signal => ProcessImage(signal.Filename))); AddReceiveProtocol("Image", (Action <dynamic>)(signal => ProcessInMemoryImage(signal.Value))); AddEmitProtocol("ThumbnailImage"); AddEmitProtocol("ExceptionMessage"); MaxSize = 320; }
public ThumbnailCreator(IReceptorSystem rsys) : base(rsys) { this.rsys = rsys; AddReceiveProtocol("ImageFilename", (Action<dynamic>)(signal => ProcessImage(signal.Filename))); AddReceiveProtocol("Image", (Action<dynamic>)(signal => ProcessInMemoryImage(signal.Value))); AddEmitProtocol("ThumbnailImage"); AddEmitProtocol("ExceptionMessage"); MaxSize = 320; }
public DayGreeter(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("Text"); AddEmitProtocol("RSSFeedUrl"); AddReceiveProtocol("RSSFeedItem", (Action <dynamic>)(s => ProcessFeedItem(s))); groups = new Dictionary <string, StringBuilder>(); }
public FeedReader(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("RSSFeedUrl", (Action <dynamic>)(s => ProcessUrl(s))); AddReceiveProtocol("RSSFeedRefresh", (Action <dynamic>)(s => AcquireFeed(lastFeedUrl))); AddEmitProtocol("RSSFeedItem"); AddEmitProtocol("ExceptionMessage"); AddEmitProtocol("LoggerMessage"); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { speechSynth = new SpeechSynthesizer(); speechSynth.SpeakCompleted += OnSpeakCompleted; speechSynth.Rate = -2; // -4; speechQueue = new Queue <string>(); AddReceiveProtocol("TextToSpeech"); AddReceiveProtocol("Text"); }
public CaveConfigurationReceptor(IReceptorSystem rsys) : base(rsys) { idToIndexMap = new Dictionary<Guid, int>(); pits = new List<int>(); bats = new List<int>(); AddReceiveProtocol("HW_WhereAmI"); AddEmitProtocol("HW_YouAre"); rnd = new Random(); }
public CaveConfigurationReceptor(IReceptorSystem rsys) : base(rsys) { idToIndexMap = new Dictionary <Guid, int>(); pits = new List <int>(); bats = new List <int>(); AddReceiveProtocol("HW_WhereAmI"); AddEmitProtocol("HW_YouAre"); rnd = new Random(); }
public ApodScraper(IReceptorSystem rsys) : base(rsys) { // AddEmitProtocol("ImageFilename"); AddEmitProtocol("Image", false); AddEmitProtocol("Url"); AddEmitProtocol("ExceptionMessage"); AddReceiveProtocol("WebPageHtml", (Action <dynamic>)(signal => ProcessPage(signal.Url.Value, signal.Html.Value))); // (new string[] { "RequireTable", "ScrapeWebpage", "ImageFilename", "DatabaseRecord", "DebugMessage", "APOD", "HaveImageMetadata" }).ForEach(p => AddEmitProtocol(p)); }
public BaseReceptor(IReceptorSystem rsys) { this.rsys = rsys; receiveProtocols = new List <ReceiveQualifier>(); emitProtocols = new List <EmittedProtocol>(); cachedEmitProtocolConfig = new Dictionary <string, bool>(); cachedReceiveProtocolConfig = new Dictionary <string, bool>(); gates = new Dictionary <string, Gate>(); compositeGates = new Dictionary <string, CompositeGate>(); Enabled = true; }
public ApodScraper(IReceptorSystem rsys) : base(rsys) { // AddEmitProtocol("ImageFilename"); AddEmitProtocol("WebImage"); AddEmitProtocol("Url"); AddEmitProtocol("ExceptionMessage"); AddReceiveProtocol("Date", (Action<dynamic>)(signal => GetImageForDate(new DateTime(signal.Year, signal.Month, signal.Day)))); AddReceiveProtocol("WebPageHtml", (Action<dynamic>)(signal => ProcessPage(signal.Url.Value, signal.Html.Value))); // (new string[] { "RequireTable", "ScrapeWebpage", "ImageFilename", "DatabaseRecord", "DebugMessage", "APOD", "HaveImageMetadata" }).ForEach(p => AddEmitProtocol(p)); }
public CaveReceptor(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("HW_YouAre", (signal) => signal.ID == id); AddReceiveProtocol("HW_MoveTo", (signal) => signal.FromCaveNumber == caveNumber || signal.NewCaveNumber == caveNumber); AddReceiveProtocol("HW_ShootInto", (signal) => signal.CaveNumber == caveNumber); AddEmitProtocol("HW_WhereAmI"); AddEmitProtocol("HW_Player"); AddEmitProtocol("Text"); caveNeighbors = new int[3]; rnd = new Random(); }
public CaveReceptor(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("HW_YouAre", (signal) => signal.ID == id); AddReceiveProtocol("HW_MoveTo", (signal) => signal.FromCaveNumber == caveNumber || signal.NewCaveNumber == caveNumber); AddReceiveProtocol("HW_ShootInto", (signal) => signal.CaveNumber == caveNumber); emitProtocols.Add("HW_WhereAmI"); emitProtocols.Add("HW_Player"); emitProtocols.Add("Text"); caveNeighbors = new int[3]; rnd = new Random(); }
public static List<string> PopulateProtocolComboBox(ComboBox cbProtocols, IReceptorSystem rsys, string protocolName) { List<string> types = rsys.SemanticTypeSystem.SemanticTypes.Keys.ToList(); types.Sort(); cbProtocols.DataSource = types; if (!String.IsNullOrEmpty(protocolName)) { cbProtocols.SelectedItem = protocolName; } return types; }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { intervalMap = new Dictionary <string, IntervalTimer>(); AddReceiveProtocol("IntervalTimerConfiguration", (Action <dynamic>)(s => IntervalTimerConfiguration(s))); AddReceiveProtocol("Recordset", s => s.Schema == "LastEventDateTime", s => LastEventDateTimeRecordset(s)); AddEmitProtocol("RequireTable"); AddEmitProtocol("DatabaseRecord"); AddEmitProtocol("TimerEvent"); }
public static List <string> PopulateProtocolComboBox(ComboBox cbProtocols, IReceptorSystem rsys, string protocolName) { List <string> types = rsys.SemanticTypeSystem.SemanticTypes.Keys.ToList(); types.Sort(); cbProtocols.DataSource = types; if (!String.IsNullOrEmpty(protocolName)) { cbProtocols.SelectedItem = protocolName; } return(types); }
public LinkedInInterface(IReceptorSystem rsys) : base(rsys) { groups = new Dictionary<string, LinkedInGroup>(); posts = new Dictionary<string, LinkedInGroupPost>(); postGroup = new Dictionary<string, LinkedInGroup>(); LoadConfiguration(); InitializeClient(); AddEmitProtocol("ExceptionMessage"); AddEmitProtocol("LinkedInGroup"); AddEmitProtocol("LinkedInPost"); AddEmitProtocol("LinkedInComment"); AddReceiveProtocol("QueryPosts", (Action<dynamic>)(signal => GetPosts(signal.LinkedInGroup.Id))); AddReceiveProtocol("QueryComments", (Action<dynamic>)(signal => GetComments(signal.LinkedInPost.Id))); }
public Alchemy(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("AlchemyEntity"); AddEmitProtocol("AlchemyKeyword"); AddEmitProtocol("AlchemyConcept"); AddEmitProtocol("Exception"); // TODO: Temporary, for demo purposes only AddEmitProtocol("RequireTable"); AddReceiveProtocol("URL", // cast is required to resolve Func vs. Action in parameter list. (Action <dynamic>)(signal => ParseUrl(signal))); }
public LinkedInInterface(IReceptorSystem rsys) : base(rsys) { groups = new Dictionary <string, LinkedInGroup>(); posts = new Dictionary <string, LinkedInGroupPost>(); postGroup = new Dictionary <string, LinkedInGroup>(); LoadConfiguration(); InitializeClient(); AddEmitProtocol("ExceptionMessage"); AddEmitProtocol("LinkedInGroup"); AddEmitProtocol("LinkedInPost"); AddEmitProtocol("LinkedInComment"); AddReceiveProtocol("QueryPosts", (Action <dynamic>)(signal => GetPosts(signal.LinkedInGroup.Id))); AddReceiveProtocol("QueryComments", (Action <dynamic>)(signal => GetComments(signal.LinkedInPost.Id))); }
public Alchemy(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("AlchemyEntity"); AddEmitProtocol("AlchemyKeyword"); AddEmitProtocol("AlchemyConcept"); AddEmitProtocol("Exception"); // TODO: Temporary, for demo purposes only AddEmitProtocol("RequireTable"); AddReceiveProtocol("URL", // cast is required to resolve Func vs. Action in parameter list. (Action<dynamic>)(signal => ParseUrl(signal))); }
public TextDisplay(IReceptorSystem rsys) : base("TextViewer.xml", true, rsys) { ShowAll = true; AddReceiveProtocol("Text", (Action<dynamic>)(signal => { form.IfNull(() => { InitializeUI(); UpdateFormLocationAndSize(); }); string text = signal.Value; if (!String.IsNullOrEmpty(text)) { // TODO: This is a real kludge for indicating that we want to clear the text in the textbox! if (text.StartsWith("!")) { tb.Clear(); text = text.Substring(1); } tb.AppendText(text.StripHtml()); tb.AppendText("\r\n"); } })); AddReceiveProtocol("Html", (Action<dynamic>)(signal => { form.IfNull(() => { InitializeUI(); UpdateFormLocationAndSize(); }); string text = signal.Value; if (!String.IsNullOrEmpty(text)) { tb.AppendText(text); tb.AppendText("\r\n"); } })); }
public TextDisplay(IReceptorSystem rsys) : base("TextViewer.xml", true, rsys) { ShowAll = true; AddReceiveProtocol("Text", (Action <dynamic>)(signal => { form.IfNull(() => { InitializeUI(); UpdateFormLocationAndSize(); }); string text = signal.Value; if (!String.IsNullOrEmpty(text)) { // TODO: This is a real kludge for indicating that we want to clear the text in the textbox! if (text.StartsWith("!")) { tb.Clear(); text = text.Substring(1); } tb.AppendText(text.StripHtml()); tb.AppendText("\r\n"); } })); AddReceiveProtocol("Html", (Action <dynamic>)(signal => { form.IfNull(() => { InitializeUI(); UpdateFormLocationAndSize(); }); string text = signal.Value; if (!String.IsNullOrEmpty(text)) { tb.AppendText(text); tb.AppendText("\r\n"); } })); }
public FeedItemList(IReceptorSystem rsys) : base(rsys, "feedItemList.xml") { MaxRecords = "40"; // The default. Categories = new List<string>(); AddReceiveProtocol("RSSFeedItem", (Action<dynamic>)(signal => ShowSignal(signal))); // TODO: This update the combobox for each category received -- can we have some way of putting all the records into a collection? AddReceiveProtocol("BookmarkCategory", (Action<dynamic>)(signal => UpdateCategoryList(signal))); AddEmitProtocol("ExceptionMessage"); AddEmitProtocol("UrlVisited"); AddEmitProtocol("RSSFeedItemDisplayed"); AddEmitProtocol("RSSFeedBookmark"); AddEmitProtocol("Query"); AddEmitProtocol("Announce"); rowStateByUrl = new Dictionary<string, ItemStates>(); }
// Other optional property overides... /// <summary> /// Constructor called when the class is instantiated. /// Do not make any assumptions about the existence of other receptors at this point. /// Typically, all we do here is register emitted and received protocols. /// </summary> public YourReceptor(IReceptorSystem rsys) : base(rsys) { // Protocols emitted by this receptor AddEmitProtocol("[protocol name]"); // Protocols received by this receptor AddReceiveProtocol("[protocol name]", // Qualifier: signal => { // Put any qualifiers here to filter specific signals based on signal data. // Replace the "return true" with a bool result. return true; }, // Action: signal => { // Put any actions, method calls, etc., when the qualified signal is received. }); }
public NlpViewer(IReceptorSystem rsys) : base(rsys) { InitializeViewer(); AddEmitProtocol("DatabaseRecord"); AddEmitProtocol("DropView"); AddEmitProtocol("RequireView"); AddReceiveProtocol("SearchDateRange", (Action<dynamic>)(signal => { SearchDateRange(signal.BeginningDate, signal.EndingDate); })); // Don't forgot, explicit cast is required for some reason to differentiate between Action<dyanmic> and Func<bool, dynamic> AddReceiveProtocol("Recordset", signal => signal.Schema == "AlchemyPhrases" && signal.Tag == "Entities", signal => ProcessEntityPhrases(signal)); AddReceiveProtocol("Recordset", signal => signal.Schema == "AlchemyPhrases" && signal.Tag == "Keywords", signal => ProcessKeywordPhrases(signal)); AddReceiveProtocol("Recordset", signal => signal.Schema == "AlchemyPhrases" && signal.Tag == "Concepts", signal => ProcessConceptPhrases(signal)); AddReceiveProtocol("Recordset", signal => signal.Schema == "AlchemyResultTypeRecord", signal => { // Save our name to ID mapping of result types. foreach(dynamic row in signal.Records) { resultTypeIDMap[row.Name] = row.ID; } LoadPhrases(); }); }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { ShowAll = true; speechSynth = new SpeechSynthesizer(); speechSynth.SpeakCompleted += OnSpeakCompleted; speechSynth.Rate = -2; // -4; speechQueue = new Queue<string>(); AddReceiveProtocol("Text", (Action<dynamic>)(signal => { string msg = signal.Value; msg = msg.StripHtml(); Speak(msg); })); // Specific protocol for announcements. AddReceiveProtocol("Announce", (Action<dynamic>)(signal => { string msg = signal.Text.Value; msg = msg.StripHtml(); Speak(msg); })); }
/// <summary> /// Instantiate the receptor from the pre-loaded assembly. /// The receptor system instance is passed to the constructor if the IReceptorInstance implementor. /// </summary> public Receptor Instantiate(IReceptorSystem rsys) { Type impType; try { impType = assembly.GetTypes(). Where(t => t.IsClass). Where(c => c.GetInterfaces().Where(i => i.Name == "IReceptorInstance").Count() > 0).Single(); } catch { throw new ApplicationException("Unable to locate the receptor assembly " + assemblyName); } try { Instance = Activator.CreateInstance(impType, new object[] { rsys }) as IReceptorInstance; Name = Instance.Name; Instance.Enabled = Enabled; } catch(Exception ex) // Need to be able to see originating exception. { throw new ApplicationException("Unable to instantiate the receptor " + Name + "\r\n" + ex.Message); } Instantiated = true; return this; }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { AddReceiveProtocol("Url"); }
public TextFileLoader(IReceptorSystem rsys) : base(rsys) { AddEmitProtocol("Text"); }
public BaseReceptor(IReceptorSystem rsys) { this.rsys = rsys; receiveProtocols = new List<ReceiveQualifier>(); emitProtocols = new List<EmittedProtocol>(); cachedEmitProtocolConfig = new Dictionary<string, bool>(); cachedReceiveProtocolConfig = new Dictionary<string, bool>(); gates = new Dictionary<string, Gate>(); compositeGates = new Dictionary<string, CompositeGate>(); Enabled = true; }
public ReceptorDefinition(IReceptorSystem rsys) : base(rsys) { // Other protocols might be added in the future. AddReceiveProtocol("ThumbnailImage", (Action<dynamic>)(signal => SaveImage(signal.Image.Value, signal.ImageFilename.Filename))); AddEmitProtocol("ExceptionMessage"); }