public SMSStorage(SMSFilterState filterState, List <SMS> filteredMessages) { FilteredMessages = filteredMessages; FilterState = filterState; SMSProvider.SMSReceived += AddToStorage; FilterState.StateUpdated += QueueMessages; }
public FakeSMSStorage(SMSFilterState filterState, List <SMS> filteredMessages, SMSFormEventArgs e) : base(filterState, filteredMessages) { Message = new SMS() { Text = "message: SMSReceived event is raised" }; this.e = e; e.Text.Text = "message: StateUpdated event is raised"; _filtersState = filterState; }
private SMSFormatDelegate SMSFormatDelegate = new SMSFormatDelegate(FormatNone);//default value public SMSForm() { InitializeComponent(); Output = new ListView(lvSMS); Filter = new SMSFilterState(FilteredMessages); Storage = new SMSStorage(Filter, FilteredMessages); #region Background thread this.Shown += BackgroundWorkerSendSMS; Storage.SMSSaved += UpdateGUISenders; Storage.SMSRemoved += UpdateGUIListView; Storage.SMSQueued += UpdateGUIListView; Filter.StateUpdated += UpdateGUIListView; #endregion #region GUI thread cboSMSSenderSelector.SelectedIndexChanged += new EventHandler(UpdateGUIFiltersBySender); //Sender dtFilterFromTime.ValueChanged += new EventHandler(UpdateGUIFiltersByTime); //FromDate dtFilterToTime.ValueChanged += new EventHandler(UpdateGUIFiltersByTime); //ToDate tbSearchTextInMessages.TextChanged += new EventHandler(UpdateGUIFiltersByText); //SearchText cboSMSFormatSelector.SelectionChangeCommitted += new EventHandler(UpdateFormatTextHandler); //Assign Delegate Handler cboSMSFormatSelector.SelectionChangeCommitted += new EventHandler(UpdateGUIListView); //Format #endregion }
public void TestInitialize() { FakeDateTime = new DateTime(2020, 12, 2, 18, 36, 00); Messages = new List <SMS>(); Messages.Add(new SMS() { Sender = "Mom", Text = "test text message #1", TimeReceived = FakeDateTime.AddSeconds(1) }); Messages.Add(new SMS() { Sender = "Bank", Text = "test text message #2", TimeReceived = FakeDateTime.AddSeconds(2) }); Messages.Add(new SMS() { Sender = "YourBro", Text = "test text message #3", TimeReceived = FakeDateTime.AddSeconds(3) }); Messages.Add(new SMS() { Sender = "Mom", Text = "test text message #4", TimeReceived = FakeDateTime.AddSeconds(4) }); Messages.Add(new SMS() { Sender = "Mom", Text = "test unique text message #5", TimeReceived = FakeDateTime.AddSeconds(5) }); Messages.Add(new SMS() { Sender = "YourBro", Text = "test text message #6", TimeReceived = FakeDateTime.AddSeconds(6) }); ExpectedFilteredMessages1 = new List <SMS>(); ExpectedFilteredMessages1.Add(new SMS() { Sender = "Bank", Text = "test text message #2", TimeReceived = FakeDateTime.AddSeconds(2) }); ExpectedFilteredMessages3 = new List <SMS>(); ExpectedFilteredMessages3.Add(new SMS() { Sender = "YourBro", Text = "test text message #3", TimeReceived = FakeDateTime.AddSeconds(3) }); FiltersState = new SMSFilterState(ExpectedFilteredMessages1); //Default Filters Criteria UserSelectedSender = new ComboBox(); UserSelectedSender.Items.Add("All"); UserSelectedSender.SelectedIndex = 0; FilterFrom = new DateTimePicker(); FilterFrom.Value = DateTimePicker.MinimumDateTime; FilterTo = new DateTimePicker(); FilterTo.Value = DateTimePicker.MaximumDateTime; TextToSearch = new TextBox(); TextToSearch.Text = ""; E = new SMSFormEventArgs(UserSelectedSender, FilterFrom, FilterTo, TextToSearch) { }; FiltersState = new SMSFilterState(ExpectedFilteredMessages1); }