Ejemplo n.º 1
0
        /// <summary>
        /// Property changes from option settings
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PropertyChangedSettings(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                ThreadContext.BeginInvokeOnUiThread(
                    delegate
                {
                    switch (e.PropertyName)
                    {
                    case "AccentColor":
                    case "ModelType":
                        ModelType = Settings.Settings.ModelType;
                        LoadGEM();
                        break;
                    }
                });
            }
            catch (Exception ex)
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow,
                    Device   = MonitorDevice.Telescope,
                    Category = MonitorCategory.Interface,
                    Type     = MonitorType.Error,
                    Method   = MethodBase.GetCurrentMethod().Name,
                    Thread   = Thread.CurrentThread.ManagedThreadId,
                    Message  = $"{ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                SkyServer.AlertState = true;
                OpenDialog(ex.Message);
            }
        }
Ejemplo n.º 2
0
        ///// <summary>
        ///// get current step count
        ///// </summary>
        ///// <param name="axis"></param>
        ///// <returns></returns>
        //private int GetEncoderCount(AxisId axis)
        //{
        //    var stepsSky = new SkyGetEncoderCount(SkyQueue.NewId, axis);
        //    var steps = (int[])SkyQueue.GetCommandResult(stepsSky).Result;
        //    if (!stepsSky.Successful && stepsSky.Exception != null) throw stepsSky.Exception;
        //    switch (axis)
        //    {
        //        case AxisId.Axis1:
        //            return steps[0];
        //        case AxisId.Axis2:
        //            return steps[1];
        //        default:
        //            throw new ArgumentOutOfRangeException(nameof(axis), axis, null);
        //    }
        //}

        /// <summary>
        /// Gets the direction to home sensor or if null then TripPosition was set
        /// </summary>
        /// <param name="axis"></param>
        /// <returns></returns>
        private bool?GetHomeSensorStatus(AxisId axis)
        {
            var sensorStatusSky = new SkyGetHomePosition(SkyQueue.NewId, axis);
            var sensorStatus    = (long)SkyQueue.GetCommandResult(sensorStatusSky).Result;

            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow,
                Device   = MonitorDevice.Telescope,
                Category = MonitorCategory.Server,
                Type     = MonitorType.Information,
                Method   = MethodBase.GetCurrentMethod().Name,
                Thread   = Thread.CurrentThread.ManagedThreadId,
                Message  = $"{sensorStatus}"
            };

            MonitorLog.LogToMonitor(monitorItem);

            switch (sensorStatus)
            {
            case 16777215:
                return(false);

            case 0:
                return(true);

            default:
                TripPosition = Convert.ToInt32(sensorStatus);
                return(null);
            }
        }
Ejemplo n.º 3
0
        public HandControlVM()
        {
            try
            {
                using (new WaitCursor())
                {
                    var monitorItem = new MonitorEntry
                    {
                        Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = "Opening Hand Control Window"
                    };
                    MonitorLog.LogToMonitor(monitorItem);

                    _skyTelescopeVM = SkyTelescopeVM._skyTelescopeVM;
                    SkyServer.StaticPropertyChanged   += PropertyChangedSkyServer;
                    SkySettings.StaticPropertyChanged += PropertyChangedSkySettings;

                    SetHCFlipsVisibility();

                    Title           = Application.Current.Resources["hcHc"].ToString();
                    ScreenEnabled   = SkyServer.IsMountRunning;
                    HcWinVisibility = false;
                    TopMost         = true;
                }
            }
            catch (Exception ex)
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Error, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"{ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                throw;
            }
        }
Ejemplo n.º 4
0
        private async Task Check(MonitorEntry entry)
        {
            ZookeeperClient zookeeperClient = null;

            try
            {
                var options = new ZookeeperClientOptions(entry.Connection)
                {
                    ConnectionTimeout = TimeSpan.FromMilliseconds(_timeout)
                };
                zookeeperClient = new ZookeeperClient(options);
                entry.Health    = true;
            }
            catch (Exception)
            {
                entry.Health = false;
            }
            finally
            {
                if (zookeeperClient != null)
                {
                    zookeeperClient.Dispose();
                }
            };
        }
Ejemplo n.º 5
0
        public SnapVM()
        {
            try
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = " Loading SnapVM"
                };
                MonitorLog.LogToMonitor(monitorItem);

                SkyServer.StaticPropertyChanged += PropertyChangedSkyServer;

                SnapEnabled = false;
            }
            catch (Exception ex)
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow,
                    Device   = MonitorDevice.Telescope,
                    Category = MonitorCategory.Interface,
                    Type     = MonitorType.Error,
                    Method   = MethodBase.GetCurrentMethod().Name,
                    Thread   = Thread.CurrentThread.ManagedThreadId,
                    Message  = $"{ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                OpenDialog(ex.Message, $"{Application.Current.Resources["exError"]}");
            }
        }
 /// <summary>
 /// 判断一个地址是否健康。
 /// </summary>
 /// <param name="address">地址模型。</param>
 /// <returns>健康返回true,否则返回false。</returns>
 public async Task <bool> IsHealth(AddressModel address)
 {
     return(await Task.Run(() =>
     {
         var ipAddress = address as IpAddressModel;
         MonitorEntry entry;
         if (!_dictionaries.TryGetValue(new Tuple <string, int>(ipAddress.Ip, ipAddress.Port), out entry))
         {
             entry = new MonitorEntry(address, SocketCheck.TestConnection(ipAddress.Ip, ipAddress.Port));
             _dictionaries.TryAdd(new Tuple <string, int>(ipAddress.Ip, ipAddress.Port), entry);
         }
         if (!entry.Health)
         {
             if (entry.LastUnhealthyDateTime.HasValue &&
                 (DateTime.Now - entry.LastUnhealthyDateTime.Value).TotalSeconds > (AppConfig.ServerOptions.HealthCheckWatchIntervalInSeconds *AppConfig.ServerOptions.AllowServerUnhealthyTimes))
             {
                 entry.Health = SocketCheck.TestConnection(ipAddress.Ip, ipAddress.Port);
                 if (entry.Health)
                 {
                     entry.UnhealthyTimes = 0;
                 }
             }
         }
         OnChanged(new HealthCheckEventArgs(address, entry.Health));
         return entry.Health;
     }));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Get axes in degrees
        /// </summary>
        /// <returns></returns>
        internal double[] AxesDegrees()
        {
            var x = Convert.ToDouble(_ioSerial.Send($"degrees,{Axis.Axis1}"));

            //put in for capture tracking in charts
            var stepsx      = _ioSerial.Send($"steps,{Axis.Axis1}");
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Data, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"steps1,{null},{stepsx}"
            };

            MonitorLog.LogToMonitor(monitorItem);

            var y = Convert.ToDouble(_ioSerial.Send($"degrees,{Axis.Axis2}"));

            //put in for capture tracking in charts
            var stepsy = _ioSerial.Send($"steps,{Axis.Axis2}");

            monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Data, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"steps2,{null},{stepsy}"
            };
            MonitorLog.LogToMonitor(monitorItem);


            var d = new[] { x, y };

            return(d);
        }
        private async Task RemoveUnhealthyAddress(MonitorEntry monitorEntry)
        {
            var addresses = monitorEntry.EndPoint;
            await _serviceCacheManager.RemveAddressAsync(new List <CacheEndpoint>() { addresses });

            _dictionary.TryRemove(new Tuple <string, int>(addresses.Host, addresses.Port), out MonitorEntry value);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Property changes from the monitor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PropertyChangedMonitor(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                ThreadContext.InvokeOnUiThread(
                    delegate
                {
                    switch (e.PropertyName)
                    {
                    case "CmdjSentEntry":
                        ProcessValues1(MonitorQueue.CmdjSentEntry);
                        break;

                    case "Cmdj2SentEntry":
                        ProcessValues2(MonitorQueue.Cmdj2SentEntry);
                        break;
                    }
                }, _ct);
            }
            catch (Exception ex)
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Error, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $" {ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                OpenDialog(ex.Message);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Process command queue
        /// </summary>
        /// <param name="command"></param>
        private static void ProcessCommandQueue(ISkyCommand command)
        {
            try
            {
                if (!IsRunning || _cts.IsCancellationRequested || !_skyWatcher.IsConnected)
                {
                    return;
                }
                command.Execute(_skyWatcher);
                if (command.Id <= 0)
                {
                    return;
                }
                if (_resultsDictionary.TryAdd(command.Id, command) == false)
                {
                    throw new MountControlException(ErrorCode.ErrQueueFailed, $"Unable to post results {command.Id}, {command}");
                }
            }
            catch (Exception e)
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"{command.Id},{e.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                command.Exception  = e;
                command.Successful = false;
            }
        }
Ejemplo n.º 11
0
        public Model3DVM()
        {
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = " Loading Model3D"
            };

            MonitorLog.LogToMonitor(monitorItem);

            SkyServer.StaticPropertyChanged         += PropertyChangedSkyServer;
            Settings.Settings.StaticPropertyChanged += PropertyChangedSettings;

            LookDirection = Settings.Settings.ModelLookDirection1;
            UpDirection   = Settings.Settings.ModelUpDirection1;
            Position      = Settings.Settings.ModelPosition1;

            LoadTopBar();
            LoadGEM();
            Rotate();

            ActualAxisX        = "--.--";
            ActualAxisY        = "--.--";
            CameraVis          = false;
            RaAxisVis          = false;
            DecAxisVis         = false;
            RaVis              = true;
            DecVis             = true;
            AzVis              = true;
            AltVis             = true;
            TopVis             = true;
            ScreenEnabled      = SkyServer.IsMountRunning;
            ModelWinVisibility = true;
            ModelType          = Settings.Settings.ModelType;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// convert a decimal Alt/Az positions to an axes positions.
        /// </summary>
        /// <param name="altAz"></param>
        /// <returns></returns>
        internal static double[] AltAzToAxesYX(double[] altAz)
        {
            var    axes = new[] { altAz[0], altAz[1] };
            double lst;

            switch (SkySettings.AlignmentMode)
            {
            case AlignmentModes.algAltAz:
                break;

            case AlignmentModes.algGermanPolar:
                lst  = SkyServer.SiderealTime;
                axes = Coordinate.AltAz2RaDec(axes[0], axes[1], SkySettings.Latitude, lst);

                axes[0] = Coordinate.Ra2Ha12(axes[0], lst) * 15.0;     // ha in degrees

                if (SkyServer.SouthernHemisphere)
                {
                    axes[1] = -axes[1];
                }

                axes = Range.RangeAzAlt(axes);

                if (axes[0] > 180.0 || axes[0] < 0)
                {
                    // adjust the targets to be through the pole
                    axes[0] += 180;
                    axes[1]  = 180 - axes[1];
                }
                break;

            case AlignmentModes.algPolar:
                lst  = SkyServer.SiderealTime;
                axes = Coordinate.AltAz2RaDec(axes[0], axes[1], SkySettings.Latitude, lst);

                axes[0] = Coordinate.Ra2Ha12(axes[0], lst) * 15.0;     // ha in degrees

                if (SkyServer.SouthernHemisphere)
                {
                    axes[1] = -axes[1];
                }

                axes = Range.RangeAzAlt(axes);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            axes = Range.RangeAxesXY(axes);

            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Server, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"Range:{axes[0]},{axes[1]}"
            };

            MonitorLog.LogToMonitor(monitorItem);

            return(new[] { axes[1], axes[0] });
        }
        private async Task RemoveUnhealthyAddress(MonitorEntry monitorEntry)
        {
            var ipAddress = monitorEntry.Address as IpAddressModel;
            await _serviceRouteManager.RemveAddressAsync(new List <AddressModel>() { ipAddress });

            _dictionaries.TryRemove(new Tuple <string, int>(ipAddress.Ip, ipAddress.Port), out MonitorEntry value);
            OnRemoved(new HealthCheckEventArgs(ipAddress));
        }
Ejemplo n.º 14
0
 public async Task Monitor(string conn)
 {
     if (!_dictionary.TryGetValue(conn, out MonitorEntry entry))
     {
         entry = new MonitorEntry(conn, await Check(conn));
         _dictionary.GetOrAdd(conn, entry);
     }
 }
Ejemplo n.º 15
0
        public NotesVM()
        {
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = " Loading NotesVM"
            };

            MonitorLog.LogToMonitor(monitorItem);
        }
        public async Task Monitor(AddressModel address)
        {
            var ipAddress = address as IpAddressModel;

            if (!_dictionary.TryGetValue(new Tuple <string, int>(ipAddress.Ip, ipAddress.Port), out MonitorEntry monitorEntry))
            {
                monitorEntry = new MonitorEntry(ipAddress, await Check(ipAddress, _timeout));
                _dictionary.TryAdd(new Tuple <string, int>(ipAddress.Ip, ipAddress.Port), monitorEntry);
            }
        }
Ejemplo n.º 17
0
        protected ObjectBase()
        {
            var monitorItem = new MonitorEntry
            {
                Datetime = Principles.HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Server, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = "CountObject"
            };

            MonitorLog.LogToMonitor(monitorItem);

            // We increment the global count of objects.
            GSServer.CountObject();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// process dec data
        /// </summary>
        /// <param name="entry"></param>
        private void ProcessValues2(MonitorEntry entry)
        {
            var date  = entry.Datetime.ToLocalTime();
            var point = new PointModel {
                DateTime = date, Value = 0, Set = ChartValueSet.Values2
            };
            var msg = entry.Message.Split(',');

            double.TryParse(msg[2], out var steps);

            if (IsZeroBased)
            {
                var zero = Conversions.Deg2ArcSec(90) * decStepsPerSecond;
                steps -= zero;
            }

            switch (Scale)
            {
            case ChartScale.Degrees:
                point.Value = Conversions.ArcSec2Deg(steps / decStepsPerSecond);
                break;

            case ChartScale.Arcsecs:
                point.Value = steps / decStepsPerSecond;
                break;

            case ChartScale.Steps:
                point.Value = steps;
                break;

            default:
                return;
            }

            if (IsLogging)
            {
                ChartLogging.LogPoint(BaseLogName, ChartType.Plot, point);
            }

            Values2.Add(point);
            if (Values2.Count > MaxPoints)
            {
                Values2.RemoveAt(0);
            }

            var item = TitleItems.FirstOrDefault(x => x.TitleName == Values2Title);

            if (item == null)
            {
                return;
            }
            item.Value = point.Value;
        }
Ejemplo n.º 19
0
        public TestVM()
        {
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = " Loading FocuserVM"
            };

            MonitorLog.LogToMonitor(monitorItem);

            if (_skyTelescopeVM == null)
            {
                _skyTelescopeVM = SkyTelescopeVM._skyTelescopeVM;
            }
        }
Ejemplo n.º 20
0
        public PlotVM()
        {
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = " Loading PlotVM"
            };

            MonitorLog.LogToMonitor(monitorItem);

            // setup property events to monitor
            MonitorQueue.StaticPropertyChanged += PropertyChangedMonitor;

            LoadDefaults();
        }
Ejemplo n.º 21
0
        internal string Send(string command)
        {
            //if (Queues.Serial.Connected) return null;
            var received = _controllers.Command(command.ToLower().Trim());

            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Data, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"{command}={received}"
            };

            MonitorLog.LogToMonitor(monitorItem);

            return(received);
        }
Ejemplo n.º 22
0
        public PoleLocatorVM()
        {
            try
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Interface, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = " Loading PoleLocatorVM"
                };
                MonitorLog.LogToMonitor(monitorItem);

                // setup property events to monitor
                SkySettings.StaticPropertyChanged += PropertyChangedSkySettings;

                MirrorFlip = true;
                CenterX    = 200;
                CenterY    = 200;
                GridAngle  = 0;
                StarCenter = $"{CenterX},{30 + YearPosition()}";

                //ConvertRaDec();
                MainVM();
                Update();
                SetHemisphere();
                SetLst();
                SetDegrees();

                _timer = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(1)
                };
                _timer.Tick += Timer_Tick;
                _timer.Start();
            }
            catch (Exception ex)
            {
                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow,
                    Device   = MonitorDevice.Telescope,
                    Category = MonitorCategory.Interface,
                    Type     = MonitorType.Error,
                    Method   = MethodBase.GetCurrentMethod().Name,
                    Thread   = Thread.CurrentThread.ManagedThreadId,
                    Message  = $"{ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                OpenDialog(ex.Message, $"{Application.Current.Resources["exError"]}");
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// adds a pulse wait item to a blocking queue for processing
        /// </summary>
        /// <param name="entry"></param>
        public static void AddPulseStatusEntry(PulseStatusEntry entry)
        {
            var add = _pulseBlockingCollection.TryAdd(entry);

            if (add)
            {
                return;
            }
            ResetGuiding(entry.Axis, false);
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Warning, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"Add Failed: {entry.Axis},{entry.Duration}"
            };

            MonitorLog.LogToMonitor(monitorItem);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// auto home for the simulator
        /// </summary>
        public AutoHomeSky()
        {
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow,
                Device   = MonitorDevice.Telescope,
                Category = MonitorCategory.Server,
                Type     = MonitorType.Information,
                Method   = MethodBase.GetCurrentMethod().Name,
                Thread   = Thread.CurrentThread.ManagedThreadId,
                Message  = "Start"
            };

            MonitorLog.LogToMonitor(monitorItem);

            Initialize();
        }
        public void MessageGrouping_DifferentSource_NoGrouping()
        {
            var subject = new MonitorWorkItem(new MonitorConfiguration())
                          .AddMessageGroupingPatterns(ExportIntegrationErrorsStep.MessageGroupingPattern);

            var firstError = new MonitorEntry(Time.UtcNow.AddSeconds(-10), "SourceA", "Message. ErrorID: 1");
            var lastError  = new MonitorEntry(Time.UtcNow, "SourceB", "Message. ErrorID: 2");

            subject.Add(firstError);
            subject.Add(lastError);

            MonitorEntry[] entries = subject.GetEntries(Target.Service);

            Assert.That(entries.Length, Is.EqualTo(2));
            Assert.That(entries[1], Is.SameAs(firstError));
            Assert.That(entries[0], Is.SameAs(lastError));
        }
Ejemplo n.º 26
0
        public void IsSatisfiedBy_MessageNotContainingText_False()
        {
            const string message = @"ServiceStack.Common.Web.HttpError
PDF file for invoice '3139004' not found on server. Customer: '3101152'.

User: [email protected]
Host: PETERJUSTESENWEB01
Details: /elmah.axd/detail?id=4E6E10FF-3A3B-4C90-ADB4-FCAC3CEFBA33";

            var entry = new MonitorEntry(Time.Now, "Source", message);

            var subject = new MessageContainsText();

            bool actual = subject.IsSatisfiedBy(entry);

            Assert.That(actual, Is.False);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Query the joystick for all items
        /// </summary>
        public void Poll()
        {
            try
            {
                if (!IsAvailable)
                {
                    return;
                }
                // joystick.Acquire();
                // joystick.Poll();
                State   = null;
                State   = joystick.GetCurrentState();
                Buttons = State.Buttons;
                Povs    = State.PointOfViewControllers;
                Xaxis   = State.X;
                Yaxis   = State.Y;
                Zaxis   = State.Z;
                // Datas = joystick.GetBufferedData();
            }
            catch (Exception ex)
            {
                IsAvailable = false;
                var monitorItem = new MonitorEntry
                {
                    Datetime = Principles.HiResDateTime.UtcNow,
                    Device   = MonitorDevice.Server,
                    Category = MonitorCategory.Server,
                    Type     = MonitorType.Error,
                    Method   = MethodBase.GetCurrentMethod().Name,
                    Thread   = Thread.CurrentThread.ManagedThreadId,
                    Message  = $"{ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);

                switch (ex.HResult)
                {
                case unchecked ((int)0x8007001E):
                case unchecked ((int)0x80040154):
                    return;

                default:
                    throw;
                }
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Reset home sensor :Wx080000[0D]
        /// </summary>
        /// <param name="axis"></param>
        private void ResetHomeSensor(AxisId axis)
        {
            var reset = new SkySetHomePositionIndex(SkyQueue.NewId, axis);
            //var _ = (long)SkyQueue.GetCommandResult(reset).Result;

            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow,
                Device   = MonitorDevice.Telescope,
                Category = MonitorCategory.Server,
                Type     = MonitorType.Information,
                Method   = MethodBase.GetCurrentMethod().Name,
                Thread   = Thread.CurrentThread.ManagedThreadId,
                Message  = $"{reset.Successful},{axis}"
            };

            MonitorLog.LogToMonitor(monitorItem);
        }
Ejemplo n.º 29
0
        public void IsSatisfiedBy_MessageContainingText_True()
        {
            const string message = @"Sitecore.Exceptions.AccessDeniedException
Application access denied.

User: sitecore\Anonymous
Host: PETERJUSTESENWEB01
Details: /elmah.axd/detail?id=D1732EFF-3AA3-4A0E-A174-E51A2848522B";

            var entry = new MonitorEntry(Time.Now, "Source", message);

            var subject = new MessageContainsText(@"Sitecore.Exceptions.AccessDeniedException
Application access denied", "Unable to connect");

            bool actual = subject.IsSatisfiedBy(entry);

            Assert.That(actual, Is.True);
        }
Ejemplo n.º 30
0
        public static void SetConnected(long id, bool value)
        {
            // add or remove the instance, this is done once regardless of the number of calls
            if (value)
            {
                var notAlreadyPresent = ConnectStates.TryAdd(id, true);

                if (Connected)
                {
                    if (!SkyServer.IsMountRunning)
                    {
                        SkyServer.IsMountRunning = true;
                    }
                }

                var monitorItem = new MonitorEntry
                {
                    Datetime = Principles.HiResDateTime.UtcNow,
                    Device   = MonitorDevice.Telescope,
                    Category = MonitorCategory.Server,
                    Type     = MonitorType.Information,
                    Method   = MethodBase.GetCurrentMethod().Name,
                    Thread   = Thread.CurrentThread.ManagedThreadId,
                    Message  = $"Add:{id},{notAlreadyPresent}"
                };
                MonitorLog.LogToMonitor(monitorItem);
            }
            else
            {
                var successfullyRemoved = ConnectStates.TryRemove(id, out _);

                var monitorItem = new MonitorEntry
                {
                    Datetime = Principles.HiResDateTime.UtcNow,
                    Device   = MonitorDevice.Telescope,
                    Category = MonitorCategory.Server,
                    Type     = MonitorType.Information,
                    Method   = MethodBase.GetCurrentMethod().Name,
                    Thread   = Thread.CurrentThread.ManagedThreadId,
                    Message  = $"Remove:{id},{successfullyRemoved}"
                };
                MonitorLog.LogToMonitor(monitorItem);
            }
        }