public ChatsControl(IEventsSource eventsSource, ChatsSettings chatsSettings) : this() { _eventsSource = eventsSource ?? throw new ArgumentNullException(nameof(eventsSource)); _chatsSettings = chatsSettings ?? throw new ArgumentNullException(nameof(chatsSettings)); Loaded += ChatsControl_Loaded; Unloaded += ChatsControl_Unloaded; ChatMessageConverter.ChatsSettings = chatsSettings; }
public EventsSummaryViewModel(IEventsSource es, IEventFilter filter) { _evsource = es; _events = new ObservableCollectionEx <EventViewModel>(_evsource.Events.Where(ev => filter.Apply(ev.Definition)).Select(ev => new EventViewModel(ev))); //_evsource.EventChanged += new EventChanged(_evsource_EventChanged); _evsource.Events.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ActiveEvents_CollectionChanged); _filter = filter; StateColor = Brushes.Green; System.Timers.Timer _timer = new System.Timers.Timer(1000); _timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed); _timer.Start(); }
public ChatControl(IEventsSource eventsSource, ChatsSettings chatsSettings) : this() { _eventsSource = eventsSource ?? throw new ArgumentNullException(nameof(eventsSource)); _chatsSettings = chatsSettings ?? throw new ArgumentNullException(nameof(chatsSettings)); _itemsControl.ItemsSource = _messages; Loaded += delegate { _eventsSource.ChatMessage += OnChatMessage; }; Unloaded += (sender, e) => _eventsSource.ChatMessage -= OnChatMessage; GotFocus += ChatControl_GotFocus; TuneControls(); }
public void Process(IEventsSource eventsSource) { var degreeOfConcurrency = CalculateDegreeOfConcurrency(); _eventsCollectionForProcess = new BlockingCollection <Guid>(2 * degreeOfConcurrency); _tasks = Enumerable .Range(0, degreeOfConcurrency) .Select(i => Task.Run(() => ProcessEvents())) .ToArray(); foreach (var @event in _eventsSource.GetEvents()) { _eventsCollectionForProcess.Add(@event); } _eventsCollectionForProcess.CompleteAdding(); Task.WaitAll(_tasks); }
public GsmLogger(IEventsSource source, GsmLoggerSettings settings) { _settings = settings; _comm = new GsmCommMain(settings.ComPort, GsmCommMain.DefaultBaudRate); _comm.PhoneConnected += new EventHandler(comm_PhoneConnected); _comm.PhoneDisconnected += new EventHandler(comm_PhoneDisconnected); try { _comm.Open(); } catch (Exception e) { throw new Exception("Unable to open the GsmLogger port"); } source.EventChanged += new EventChanged(source_EventChanged); }
public CalendarMonthView(IEventsSource dataSource) : this(DateTime.Today) { this.dataSource = dataSource; }
public CalendarMonthView(DateTime currentDate, IEventsSource dataSource) : this(currentDate, true) { this.dataSource = dataSource; }
public RotatingCalendarView(RectangleF rect, IEventsSource source, float tabBarHeight) { dataSource = source; //notificationObserver = NSNotificationCenter.DefaultCenter.AddObserver ("EKEventStoreChangedNotification", EventsChanged); CurrentDate = DateTime.Today; SingleDayView = new CalendarDayTimelineView(rect, tabBarHeight, dataSource, true); SingleDayLandscapeView = new CalendarDayTimelineView(new RectangleF(0, 0, 480, 320), 0, dataSource, false); //WeekView = new TrueWeekView (CurrentDate, dataSource); //WeekView.UseCalendar = true; //LandscapeLeftView = WeekView; //LandscapeRightView = WeekView; LandscapeLeftView = SingleDayLandscapeView; LandscapeRightView = SingleDayLandscapeView; PortraitView = SingleDayView; //SingleDayView.ForceAutoRotate = delegate{ForceAutoRotate();}; SingleDayView.OnEventClicked += theEvent => { if (theEvent != null) { if (OnEventClicked != null) { OnEventClicked(theEvent); } } }; SingleDayLandscapeView.OnEventClicked += theEvent => { if (theEvent != null) { if (OnEventClicked != null) { OnEventClicked(theEvent); } } }; SingleDayView.OnNewEvent += date => { if (date != null) { if (OnAddEvent != null) { OnAddEvent(date); } } }; SingleDayLandscapeView.OnNewEvent += date => { if (date != null) { if (OnAddEvent != null) { OnAddEvent(date); } } }; SingleDayView.dateChanged += theDate => { if (!preventUpdates) { preventUpdates = true; CurrentDate = theDate; //SingleDayLandscapeView.SetDate(theDate); SingleDayLandscapeView.SetDateAndReloadDay(theDate); preventUpdates = false; } }; SingleDayLandscapeView.dateChanged += theDate => { if (!preventUpdates) { preventUpdates = true; CurrentDate = theDate; SingleDayView.SetDateAndReloadDay(theDate); preventUpdates = false; } }; //this.OnEventClicked += theEvent => //{ // //Util.MyEventStore.RemoveEvents(Util.getEvent(theEvent),EKSpan.ThisEvent,theError.Handle); // addController = new EKEventEditViewController (); // // set the addController's event store to the current event store. // addController.EventStore = Util.MyEventStore; // addController.Event = Util.getEvent (theEvent); // addController.Completed += delegate(object sender, EKEventEditEventArgs e) { this.DismissModalViewControllerAnimated (true); }; // try { // if (this.ModalViewController == null) // this.NavigationController.PresentModalViewController (addController, true); // } catch (Exception ex) { // //rotatingView.NavigationController.PopViewControllerAnimated(false); // } //}; }
public static List <IEvent> GetEvents(DateTime from, DateTime to, IEventsSource source) { List <IEvent> evl = new List <IEvent>(); DataTable dt = ArchiverMain.Current.Accessor.GetEvents(from, to); foreach (System.Data.DataRow row in dt.Rows) { DateTime date = new DateTime(); String text = row["Text"].ToString(); int st; int ID; int.TryParse(row["EventID"].ToString(), out ID); int.TryParse(row["Cause"].ToString(), out st); EventState state = (EventState)st; DateTime.TryParse(row["Time"].ToString(), out date); try { IEvent ev; switch (state) { case EventState.Start: evl.Insert(0, ev = new Event(Env.Current.EventManager[ID].Definition, source, text)); ev.StartTime = date; break; case EventState.End: ev = evl.Where(evm => evm.Definition.Id == ID).FirstOrDefault(); if (ev == null || !ev.IsActive) { evl.Insert(0, ev = new Event(Env.Current.EventManager[ID].Definition, source, text)); } ev.EndTime = date; break; case EventState.Ack: ev = evl.Where(evm => evm.Definition.Id == ID).FirstOrDefault(); if (ev == null || !ev.IsActive) { evl.Insert(0, ev = new Event(Env.Current.EventManager[ID].Definition, source, text)); } ev.AckTime = date; break; } } catch (EventNotExistsException e) { IEvent ev; ev = new Event(new CommonEventDefinition(e.Message), source, e.Message); ev.StartTime = DateTime.Now; ev.EndTime = DateTime.Now; ev.AckTime = DateTime.Now; evl.Insert(0, ev); } } return(evl); }
public void RegisterEventProvider(string type, IEventsSource source, IEventsStorage storage) { EventsProviders.Add(type, new EventProvider(type, source, storage)); }
public void Process(IEventsSource eventsSource) { Parallel.ForEach(eventsSource.GetEvents(), ProcessEvents); }
public TrueWeekView(DateTime date, IEventsSource dataSource) { this.dataSource = dataSource; SetDayOfWeek(date); BackgroundColor = UIColor.White; SetupWindow(); curRect = new RectangleF(0, GetStartPosition(DateTime.Now), myScrollView.ContentSize.Width, myScrollView.ContentSize.Height); curZoom = myScrollView.ZoomScale; }
public CalendarMonthView(DateTime currentDate, bool showToolBar, IEventsSource dataSource) : this(currentDate, showToolBar) { this.dataSource = dataSource; }
public RotatingCalendarView(RectangleF rect, IEventsSource source) : this(rect, source, 0) { }
public Event(IEventDefinition def, IEventsSource source) : this(def, source, def.Text) { }
public Event(IEventDefinition def, IEventsSource source, String text) { Text = text; _def = def; Source = source; }
public CalendarDayTimelineView(IEventsSource dataSource) { this.dataSource = dataSource; var screenFrame = UIScreen.MainScreen.Bounds; NavBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height; Frame = new RectangleF(0, 0, screenFrame.Width, screenFrame.Height); orgRect = Frame; setup(); setupCustomInitialisation(); }
public CalendarDayTimelineView(RectangleF rect, float tabBarHeight, IEventsSource dataSource, bool isPortrait) { _isPortrait = isPortrait; this.dataSource = dataSource; orgRect = rect; NavBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height; Frame = rect; setup(); setupCustomInitialisation(); }
public TrueWeekViewController(DateTime date, IEventsSource dataSource) { weekView = new TrueWeekView(date, dataSource) { Frame = new RectangleF(0, 0, 480, 220) }; SetCurrentDate(date); View.AddSubview(weekView); }
private static void MakeExperiment(string experimentName, IEventsProcessor eventsProcessor, IEventsSource eventsSource) { Console.WriteLine($"=========== {experimentName} ==========="); var stopWatch = new Stopwatch(); stopWatch.Start(); eventsProcessor.Process(eventsSource); stopWatch.Stop(); Console.WriteLine($"Duration of experiment = {stopWatch.ElapsedMilliseconds} milliseconds."); }
public EventProvider(string type, IEventsSource source, IEventsStorage storage) { this.Type = type; this.Source = source; this.Storage = storage; }