示例#1
0
 void EnteredRegion(object sender, MonitorEventArgs e)
 {
     if (_paused)
     {
         ShowNotification();
     }
 }
示例#2
0
 public void ExitedRegion(object sender, MonitorEventArgs e)
 {
     if (e.Region != null)
     {
         PrepareRangingEventProperties(false, e.Region.UniqueId);
     }
 }
        // Pause Resume on User Activity Monitor
        private void _userActivity_MonitorTriggeredEvent(object sender, MonitorEventArgs e)
        {
            UserActivity userActivity = sender as UserActivity;

            if (userActivity == null)
            {
                return;
            }
            if (_userActivityTriggeredCurrentlyProcessing)
            {
                return;
            }

            lock (_userActivityMutex)
            {
                if (_userActivityTriggeredCurrentlyProcessing)
                {
                    return;
                }
                _userActivityTriggeredCurrentlyProcessing = true;

                if (userActivity.UserActiveState == UserActivityState.Inactive)
                {
                    _workingItem.Pause(e.Reason);
                    notifyIcon.Text           = GetStringWithEllipsis(string.Format(CultureInfo.CurrentCulture, "{0} {1}{2}\n{3}", Resources.Paused, Resources.NotifyIconText, _workingItem.WorkItem.Id, _workingItem.WorkItem.Title), 63);
                    notifyIcon.BalloonTipText = string.Format(CultureInfo.CurrentCulture, Resources.PausedWorkingOn, _workingItem.WorkItem.Id, GetStringWithEllipsis(_workingItem.WorkItem.Title, 50));
                    notifyIcon.ShowBalloonTip(_currentSettings.BalloonTipTimeoutSeconds * 1000);
                }
                else if (userActivity.UserActiveState == UserActivityState.Active)
                {
                    bool record = false;
                    if (_currentSettings.PromptOnResume)
                    {
                        DialogResult dialogResult = MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.PromptOnResumeText, _workingItem.WorkItem.Id, _workingItem.WorkItem.Title),
                                                                    Resources.PromptOnResumeCaption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                        switch (dialogResult)
                        {
                        case DialogResult.Cancel:
                            StartStop();
                            return;

                        case DialogResult.Yes:
                            record = true;
                            break;
                        }
                    }
                    if (_workingItem.Paused)
                    {
                        _workingItem.Resume(record);
                    }
                    notifyIcon.Text           = GetStringWithEllipsis(string.Format(CultureInfo.CurrentCulture, "{0} {1}{2}\n{3}", Resources.Resumed, Resources.NotifyIconText, _workingItem.WorkItem.Id, _workingItem.WorkItem.Title), 63);
                    notifyIcon.BalloonTipText = string.Format(CultureInfo.CurrentCulture, Resources.ResumedWorkingOn, _workingItem.WorkItem.Id, GetStringWithEllipsis(_workingItem.WorkItem.Title, 50));
                }
                notifyIcon.ShowBalloonTip(_currentSettings.BalloonTipTimeoutSeconds * 1000);
            }
            _userActivityTriggeredCurrentlyProcessing = false;
        }
        private void HandleMonitorContendedEntered(object sender, MonitorEventArgs e)
        {
            if (e.SuspendPolicy == SuspendPolicy.All)
            {
                Interlocked.Increment(ref _suspended);
            }

            throw new NotImplementedException();
        }
        protected virtual async void OnTaskPerformed(MonitorEventArgs e)
        {
            var handler = TaskPerformed;

            if (handler != null)
            {
                await handler(this, e).ConfigureAwait(false);
            }
        }
示例#6
0
        /// <summary>
        ///     Invokes the on message sended.
        /// </summary>
        /// <param name="monitorEventArgs"></param>
        private void InvokeOnMessageSent(MonitorEventArgs monitorEventArgs)
        {
            MonitorEventHandler handler = OnMessageSent;

            if (handler != null)
            {
                var thread = new Thread(() => handler(this, new MonitorEventArgs()));
                thread.Start();
            }
        }
示例#7
0
        private void ExitRegionComplete(object sender, MonitorEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("ExitRegionComplete ---- StopRanging");
            System.Diagnostics.Debug.WriteLine(e.ToString());

            MainActivity activity = Xamarin.Forms.Forms.Context as MainActivity;

            _beaconManager = BeaconManager.GetInstanceForApplication(activity);
            //_beaconManager.StopRangingBeaconsInRegion(_fieldRegion);
        }
        private void ExitedRegion(object sender, MonitorEventArgs e)
        {
            Console.WriteLine("ExitedRegion");

            // even
            var message = new BeaconRangedEventArgs {
                Inside = false
            };

            OnBeaconRanged(message);
        }
示例#9
0
        void monitor_MonitorUnlocked(object sender, MonitorEventArgs e)
        {
            log.Debug("Computer unlocked!");
            TimeSpan span = System.DateTime.Now - LockedTime;

            log.Debug("Locked Seconds : " + span.TotalSeconds);
            if (span.TotalSeconds >= BreakingSeconds)
            {
                CompleteBreaking();
            }
        }
示例#10
0
 //Passes monitored item to service session to add to subscription.
 public void OPCMonitor(object sender, MonitorEventArgs e)
 {
     try
     {
         client.OPCMonitor(e.subscription, e.monitoredItem);
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
示例#11
0
 private void MonitorNotifier_MonitorOpened(object sender, MonitorEventArgs e)
 {
     i++;
     if (i >= 10)
     {
         i = 0;
         MonitorNotifier.MonitorOpened -= MonitorNotifier_MonitorOpened;
         return;
     }
     log.Info("Turning off " + i);
     MonitorController.TurnOff();
 }
示例#12
0
        /// <summary>
        /// Messages the received.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="Mrwesb.Core.Monitoring.MonitorEventArgs"/> instance containing the event data.</param>
        private void MessageReceived(object sender, MonitorEventArgs args)
        {
            if (Status != MonitorStatus.Started)
            {
                return;
            }

            CountMessages++;
            if (CountMessages % 10 == 0)
            {
                MonitoringSender.Send(new MonitoringMessageFake {
                    Count = CountMessages
                });
            }
        }
        private void ExitedRegion(object sender, MonitorEventArgs e)
        {
            Log.Debug("FLBEACON", "ExitedRegion");

            // even
            var message = new BeaconRangedEventArgs {
                Inside = false
            };

            OnBeaconRanged(message);

            Log.Debug("FLBEACON", "Stop Request Updates from Beacon");
            LocationManagerService.StopRequestLocationUpdates();

            notificationService.SendNotification("Beacon", "Exited Region");

            logService.WriteToLog(LOG_FILENAME, "ExitedRegion");
        }
        private void ExitedRegion(object sender, MonitorEventArgs e)
        {
            string region = "???";

            if (e.Region != null)
            {
                if (e.Region.Id1 == null)
                {
                    region = "null region";
                }
                else
                {
                    region = e.Region.Id1.ToString().ToUpper();
                }
            }

            Xamarin.Forms.MessagingCenter.Send <App, string>((App)Xamarin.Forms.Application.Current, "ExitedRegion", region);
            Console.WriteLine("ExitedRegion");
        }
示例#15
0
 private static void SensLogon_DisplayUnlock(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Screen Unlocked: " + e.UserName);
 }
示例#16
0
 static void notifier_StartScreenSaver(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Start Screen Saver: " + e.UserName);
 }
示例#17
0
 static void notifier_MonitorShutdown(object sender, MonitorEventArgs e)
 {
     log.Info("**************Shutdown by " + e.UserName);
 }
示例#18
0
        public void ReceiveMonitoringNotification(object sender, MonitorEventArgs args)
        {
            string message = string.Format("{0, -13}{1, -22}{2,-20}{3,-20}", args.ClientId, args.EventTime.ToLongTimeString(), args.ThreadId, args.EventType);

            _syncContext.Post(state => this.listBoxExecutionProgress.Items.Add(message), null);
        }
示例#19
0
 private void DeterminedStateForRegionComplete(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("DeterminedStateForRegionComplete");
 }
示例#20
0
 internal void OnMonitorContendedEntered(MonitorEventArgs e)
 {
     var t = MonitorContendedEntered;
     if (t != null)
         t(this, e);
 }
 private static Task OnTaskPerformed(object sender, MonitorEventArgs e)
 {
     return(Task.Delay(1));
 }
示例#22
0
 private void DetermineStateForRegionComplete(object sender, MonitorEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("DetermineStateForRegionComplete");
     System.Diagnostics.Debug.WriteLine(e.ToString());
 }
示例#23
0
 private static void SensLogon_DisplayUnlock(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Screen Unlocked: " + e.UserName);
 }
示例#24
0
 static void notifier_StopScreenSaver(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Stop Screen Saver " + e.UserName);
 }
 private void _nag_MonitorTriggeredEvent(object sender, MonitorEventArgs e)
 {
     notifyIcon.BalloonTipText = Resources.NagMessage;
     notifyIcon.ShowBalloonTip(_currentSettings.BalloonTipTimeoutSeconds * 1000);
 }
示例#26
0
 private async Task OnTaskPerformed(object sender, MonitorEventArgs e)
 {
     await Task.Delay(1);
 }
示例#27
0
 public void ReceiveMonitoringNotification(object sender, MonitorEventArgs args)
 {
     string message = string.Format("{0, -15}{1, -20}{2}", args.ClientId, args.EventTime.ToLongTimeString(), args.EventType);
     _syncContext.Post(state => this.listBoxExecutionProgress.Items.Add(message), null);
 }
		private void EnteredRegion(object sender, MonitorEventArgs e)
		{
			Console.WriteLine("EnteredRegion");
		}
示例#29
0
        void MonitorTick(object sender, MonitorEventArgs e)
        {
            if (Usuario == null)
            {
                return;
            }

            try
            {
                Monitor.TimerInterval    = 20;
                Monitor.CallbackArgument = DateTime.UtcNow.ToString();

                var count = 0;

                if (SelectedEntidades.Count > 0)
                {
                    foreach (var entidad in SelectedEntidades)
                    {
                        var style = GetMarkerStyle(entidad);

                        AddMarker(entidad, style);
                        count++;
                        if (SelectedEntidades.Count == 1)
                        {
                            Monitor.SetCenter(entidad.ReferenciaGeografica.Latitude, entidad.ReferenciaGeografica.Longitude);
                        }
                    }

                    if (SelectedMessages.Count > 0)
                    {
                        var selectedDispositivos = SelectedEntidades.Select(entidad => entidad.Dispositivo).ToList();

                        var popups = SharedPositions.GetNewPopupsM2M(selectedDispositivos, DAOFactory)
                                     .Where(p => SelectedMessages.Contains(p.CodigoMensaje));

                        var sonidos   = new List <string>();
                        var lastMsg   = LastMessage;
                        var newPopups = 0;
                        foreach (var popup in popups)
                        {
                            if (popup.Id > lastMsg)
                            {
                                Monitor.AddCallbackScript("AddEvent('" + GetMessageM2M(popup) + "');");
                                if (!string.IsNullOrEmpty(popup.Sound) &&
                                    !sonidos.Contains(Config.Directory.SoundsDir + popup.Sound))
                                {
                                    sonidos.Add(Config.Directory.SoundsDir + popup.Sound);
                                }
                                LastMessage = Math.Max(popup.Id, LastMessage);
                                newPopups++;
                            }
                        }
                        if (sonidos.Count > 0)
                        {
                            Monitor.AddCallbackScript("enqueueSounds(['" + string.Join("','", sonidos.ToArray()) + "']);");
                        }

                        if (newPopups > 0)
                        {
                            Monitor.AddCallbackScript("if(!PopupPanelOpen)ShowEvents();");
                        }
                    }
                }

                // Inserto un script personalizado que muestra un mensaje en pantalla
                Monitor.AddCallbackScript(string.Format("$get('{0}').innerHTML = '{1}';",
                                                        lblInfo.ClientID,
                                                        string.Format(CultureManager.GetSystemMessage("ONLINE_UPDATED_POSITIONS"),
                                                                      count,
                                                                      DateTime.UtcNow.ToDisplayDateTime().ToString("HH:mm:ss"))));
            }
            catch (Exception ex)
            {
                // Inserto un script personalizado que muestra el error en pantalla
                Monitor.AddCallbackScript(string.Format("$get('{0}').innerHTML = '{1}';", lblInfo.ClientID, ex.Message));
            }

            Monitor.AddCallbackScript("lastUpdate = new Date();");
        }
示例#30
0
 private void EnteredRegion(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("EnteredRegion");
 }
示例#31
0
        private void ReceiveMonitoringNotification(object sender, MonitorEventArgs e)
        {
            string header = string.Format(" {0,-13} {1,-22} {2} ", e.clientId, e.now.ToLongTimeString(), e.eventType);

            _syncContext.Post(state => this.listBox1.Items.Add(header), null);
        }
示例#32
0
 private void EnteredRegion(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("EnteredRegion");
     Toast.MakeText(Xamarin.Forms.Forms.Context, "EnteredRegion", ToastLength.Long).Show();
     WriteToLocFile("EnteredRegion");
 }
 private void DeterminedStateForRegionComplete(object sender, MonitorEventArgs e)
 {
 }
 protected override void OnMonitorConnected(MonitorEventArgs e)
 {
     base.OnMonitorConnected(e);
 }
示例#35
0
 void monitor_MonitorLocked(object sender, MonitorEventArgs e)
 {
     log.Debug("Computer locked!");
     LockedTime = System.DateTime.Now;
 }
示例#36
0
        private void HandleMonitorContendedEntered(object sender, MonitorEventArgs e)
        {
            if (e.SuspendPolicy == SuspendPolicy.All)
                Interlocked.Increment(ref _suspended);

            throw new NotImplementedException();
        }
示例#37
0
 static void notifier_MonitorUnlocked(object sender, MonitorEventArgs e)
 {
     log.Info("**************Locked by " + e.UserName);
 }
示例#38
0
 void ExitedRegion(object sender, MonitorEventArgs e)
 {
 }
		private void DeterminedStateForRegionComplete(object sender, MonitorEventArgs e)
		{
			Console.WriteLine("DeterminedStateForRegionComplete");
		}