Ejemplo n.º 1
0
 void EnteredRegion(object sender, MonitorEventArgs e)
 {
     if (_paused)
     {
         ShowNotification();
     }
 }
Ejemplo n.º 2
0
 public void ExitedRegion(object sender, MonitorEventArgs e)
 {
     if (e.Region != null)
     {
         PrepareRangingEventProperties(false, e.Region.UniqueId);
     }
 }
Ejemplo n.º 3
0
        // 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);
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
        private void ExitedRegion(object sender, MonitorEventArgs e)
        {
            Console.WriteLine("ExitedRegion");

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

            OnBeaconRanged(message);
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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");
        }
Ejemplo n.º 14
0
        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");
        }
Ejemplo n.º 15
0
 private static void SensLogon_DisplayUnlock(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Screen Unlocked: " + e.UserName);
 }
Ejemplo n.º 16
0
 static void notifier_StartScreenSaver(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Start Screen Saver: " + e.UserName);
 }
Ejemplo n.º 17
0
 static void notifier_MonitorShutdown(object sender, MonitorEventArgs e)
 {
     log.Info("**************Shutdown by " + e.UserName);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 19
0
 private void DeterminedStateForRegionComplete(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("DeterminedStateForRegionComplete");
 }
Ejemplo n.º 20
0
 internal void OnMonitorContendedEntered(MonitorEventArgs e)
 {
     var t = MonitorContendedEntered;
     if (t != null)
         t(this, e);
 }
Ejemplo n.º 21
0
 private static Task OnTaskPerformed(object sender, MonitorEventArgs e)
 {
     return(Task.Delay(1));
 }
Ejemplo n.º 22
0
 private void DetermineStateForRegionComplete(object sender, MonitorEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("DetermineStateForRegionComplete");
     System.Diagnostics.Debug.WriteLine(e.ToString());
 }
Ejemplo n.º 23
0
 private static void SensLogon_DisplayUnlock(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Screen Unlocked: " + e.UserName);
 }
Ejemplo n.º 24
0
 static void notifier_StopScreenSaver(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("Stop Screen Saver " + e.UserName);
 }
Ejemplo n.º 25
0
 private void _nag_MonitorTriggeredEvent(object sender, MonitorEventArgs e)
 {
     notifyIcon.BalloonTipText = Resources.NagMessage;
     notifyIcon.ShowBalloonTip(_currentSettings.BalloonTipTimeoutSeconds * 1000);
 }
Ejemplo n.º 26
0
 private async Task OnTaskPerformed(object sender, MonitorEventArgs e)
 {
     await Task.Delay(1);
 }
Ejemplo n.º 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");
		}
Ejemplo n.º 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();");
        }
Ejemplo n.º 30
0
 private void EnteredRegion(object sender, MonitorEventArgs e)
 {
     Console.WriteLine("EnteredRegion");
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 35
0
 void monitor_MonitorLocked(object sender, MonitorEventArgs e)
 {
     log.Debug("Computer locked!");
     LockedTime = System.DateTime.Now;
 }
Ejemplo n.º 36
0
        private void HandleMonitorContendedEntered(object sender, MonitorEventArgs e)
        {
            if (e.SuspendPolicy == SuspendPolicy.All)
                Interlocked.Increment(ref _suspended);

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