示例#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);
            }
        }
示例#2
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;
        }
示例#3
0
 private void DownLoadProcessForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (IsDownload)
     {
         if (MessageBox.Show("是否中断分拣任务下载?", "提示", MessageBoxButtons.YesNo) == DialogResult.No)
         {
             e.Cancel = true;
             return;
         }
         else
         {
             if (thread != null)
             {
                 if (thread.IsAlive)
                 {
                     thread.Abort();
                     thread = null;
                     MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                     monitorLog.LOGNAME     = "线程中止";
                     monitorLog.LOGINFO     = "分拣任务下载线程中止";
                     monitorLog.LOGLOCATION = "线程操作";
                     monitorLog.LOGTYPE     = 2;
                     monitorLog.Save();
                 }
             }
         }
     }
     DownloadData.OnProcessFinish  -= new EventHandler <DownloadArgs>(DownloadData_OnProcessFinish);
     DownloadData.OnPrecessUpdate  -= new EventHandler <DownloadPrecess>(DownloadData_OnPrecessUpdate);
     DownloadData.OnProcessStart   -= new EventHandler <StepNameEvenArgs>(DownloadData_OnProcessStart);
     DownloadData.OnProcessError   -= new EventHandler <DownloadErrorArgs>(DownloadData_OnProcessError);
     MonitorLog.OnLogCreate        -= new EventHandler <DataEvenArgs>(MonitorLog_OnLogCreate);
     DownloadData.OnDownLoadFinish -= new EventHandler <EventArgs>(DownloadData_OnDownLoadFinish);
     DownloadData.OnTransferFinish -= new EventHandler <DownloadArgs>(DownloadData_OnTransferFinish);
 }
示例#4
0
        private void C_SortingMain_Load(object sender, EventArgs e)
        {
            SortingLineTaskQueue.OnUpdateCSortingMainCubeEvent +=
                new EventHandler <EventArgs>(cSortingTask_OnUpdateCSortingMainCubeEvent);
            CSortingTask.OnUpdateCSortingMainNumEvent +=
                new EventHandler <UpdateCSortingMainNumEventArgs>(cSortingTask_OnUpdateCSortingMainNumEvent);
            CSortingTask.OnTaskMoved += new EventHandler <EventArgs>(CSortingTask_OnTaskMoved);
            if (IsVerifyPass())
            {
                MonitorLog monitorLog;
                monitorLog             = MonitorLog.NewMonitorLog();
                monitorLog.LOGNAME     = "数据库读取";
                monitorLog.LOGINFO     = "订单数据读取成功!";
                monitorLog.LOGLOCATION = "数据库";
                monitorLog.LOGTYPE     = 1;
                monitorLog.Save();
            }
            //获取任务列表
            SortingLineTaskQueue.GetInstance().LoadSortingLineTasks();
            LoadLinBox();
            LoadCube();
            chkshowqty.Checked = true;


            //电子标签初始化
            ATOPTagSdk.InitTags();
        }
示例#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"]}");
            }
        }
示例#6
0
        void DownloadData_OnProcessFinish(object sender, DownloadArgs e)
        {
            if (this.InvokeRequired)
            {
                if (e.OrderType == 1)
                {
                    this.Invoke(new Action(FJMainForm.Instance.cSortingTask.ReLoad));
                    this.Invoke(new Action(FJMainForm.Instance.CBox.LoadCigBox));
                    this.Invoke(new Action(FJMainForm.Instance.SetVision));
                    this.Invoke(new Action(FJMainForm.Instance.SetOutPort));
                    this.Invoke(new Action(FJMainForm.Instance.CSortingMain.ReLoad));
                }
                else if (e.OrderType == 2)
                {
                    this.Invoke(new Action(FJMainForm.Instance.cAbnSortingTask.ReLoad));
                    this.Invoke(new Action(FJMainForm.Instance.CAbnBox.LoadCigBox));
                    this.Invoke(new Action(FJMainForm.Instance.SetVision));
                }
            }

            IsDownload = false;

            MonitorLog monitorLog = MonitorLog.NewMonitorLog();

            monitorLog.LOGNAME     = "线程完成";
            monitorLog.LOGINFO     = e.LineName + "分拣任务下载完成";
            monitorLog.LOGLOCATION = "线程操作";
            monitorLog.LOGTYPE     = 1;
            monitorLog.Save();
        }
示例#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);
        }
示例#8
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;
            }
        }
示例#9
0
文件: CInTask.cs 项目: wg3281/JZFJ
        public void StopScanTask()
        {
            taskStatus = TaskStatus.Stop;
            if (thread != null)
            {
                while (thread.IsAlive)
                {
                    Thread.Sleep(300);
                }
                thread = null;


                if (OnTaskStatusChanged != null)
                {
                    OnTaskStatusChanged.Invoke(null, new EventArgs());
                }
                monitorLog             = MonitorLog.NewMonitorLog();
                monitorLog.LOGNAME     = "线程操作";
                monitorLog.LOGINFO     = "补货线程停止!";
                monitorLog.LOGLOCATION = "线程";
                monitorLog.LOGTYPE     = 0;
                monitorLog.Save();

                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                config.AppSettings.Settings["IsStart"].Value = false.ToString();
                config.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection("appSettings");
            }
            OnOnTaskStopFinished();
        }
示例#10
0
 /// <summary>
 /// 操作日志进入数据库(异步写入消息队列)
 /// </summary>
 /// <param name="entity"></param>
 public void InsertBusLogs(MonitorLog entity)
 {
     //await Task.Run(() =>
     //{
     //    _applicationEventBus.Publisher(new MonitorLogEvent(entity));
     //});
 }
示例#11
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);
            }
        }
示例#12
0
        private static async Task Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DebugLoger.DebugLogerInstance.init(ENSource.Advertise, false);
            // var frm11 = new FrmTest();
            //frm11.ShowDialog();


            PerformanceEntities.ErrorHandler.AddHandler(false, false, false, Assembly.GetExecutingAssembly().GetName().Version.ToString(), ENSource.Advertise, Application.StartupPath, 123456789, "accountingerrorlog", "accountingerrorlog", 10, 50);
            MonitorLog.Initialize(true, ENSource.Advertise, Assembly.GetExecutingAssembly().GetName().Version.ToString(), 10, 30, "accountingerrorlog", "accountingerrorlog", 1, 500);

            await AccSqlServerPersistence.cache.GetCache(ClsConnection.ConnectionString, Path.Combine(Application.StartupPath, "sqlite.db"), ImagePath(), new List <ClientConfig>() { new ClientConfig()
                                                                                                                                                                                      {
                                                                                                                                                                                          Source = ENSource.Advertise
                                                                                                                                                                                      } }, new CancellationTokenSource(),
                                                         1, ENSource.Advertise, advertise : true);

            await Task.Run(() => { ClsConnection.Backup(); });

            var frm = new frmTestMain();

            try
            {
                frm.ShowDialog();
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorLogInstance.StartLog(ex);
            }

            CloseAllChromeWindows();
        }
示例#13
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;
            }
        }
示例#14
0
        public static bool IsCurrentOrder()
        {
            using (var cn = new MySqlConnection(AppUtil._LocalConnectionString))
            {
                cn.Open();
                using (var cm = cn.CreateCommand())
                {
                    cm.CommandText =
                        "SELECT COUNT(1) FROM (SELECT  MAX(T_SORTING_LINE_TASK_ABNORMAL.ORDERDATE ) da FROM T_SORTING_LINE_TASK_ABNORMAL)  t WHERE t.da = @Date";
                    cm.Parameters.AddWithValue("@Date", DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"));
                    if (int.Parse(cm.ExecuteScalar().ToString()) <= 0)
                    {
                        MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                        monitorLog.LOGNAME     = "数据库读取";
                        monitorLog.LOGINFO     = "当前异型烟订单日期与系统日期不符合!";
                        monitorLog.LOGLOCATION = "数据库";
                        monitorLog.LOGTYPE     = 2;
                        monitorLog.Save();
                        return(false);
                    }

                    return(true);
                }
            }
        }
示例#15
0
 /// <summary>
 /// 同一批次是否存在重复的顺序号
 /// </summary>
 /// <returns></returns>
 public static bool IsIndexRepetition()
 {
     using (var cn = new MySqlConnection(AppUtil._LocalConnectionString))
     {
         cn.Open();
         using (var cm = cn.CreateCommand())
         {
             cm.CommandText =
                 "SELECT SEQUENCENO,COUNT(1)  FROM T_INTASK_ABNORMAL  GROUP BY SEQUENCENO HAVING count(1)> 1";
             using (var dr = new SafeDataReader(cm.ExecuteReader()))
             {
                 while (dr.Read())
                 {
                     MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                     monitorLog.LOGNAME     = "数据库读取";
                     monitorLog.LOGINFO     = "当前异型烟补货任务存在重复的顺序号!";
                     monitorLog.LOGLOCATION = "数据库";
                     monitorLog.LOGTYPE     = 2;
                     monitorLog.Save();
                     return(true);
                 }
             }
             return(false);
         }
     }
 }
 /// <summary>操作日志进入数据库</summary>
 /// <param name="entity"></param>
 public async void InsertBusLogs(MonitorLog entity)
 {
     await Task.Run(() =>
     {
         _applicationEventBus.Publisher(new MonitorLogEvent(entity));
     });
 }
        public async Task <IHttpActionResult> GetTexts()
        {
            var url = Helper.GetNextUrl();

            MonitorLog   monitorLog = new MonitorLog();
            TextsWithLog textLog    = new TextsWithLog();

            monitorLog.BeginTime = DateTime.Now;
            monitorLog.URL       = url;

            HttpResponseMessage response = await Client.GetAsync(url + "api/texts/");

            Thread.Sleep(5000);
            if (response.IsSuccessStatusCode)
            {
                List <Texts> texts = await response.Content.ReadAsAsync <List <Texts> >();

                if (texts == null)
                {
                    return(NotFound());
                }

                monitorLog.EndTime = DateTime.Now;

                var logResult = await Client.PostAsJsonAsync(url + "api/monitorLogs/", monitorLog);

                textLog.MonitorLog = await logResult.Content.ReadAsAsync <MonitorLog>();

                textLog.Texts = texts;

                return(Ok(textLog));
            }
            return(BadRequest());
        }
示例#18
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            labvision.Text = InTask.GetInTaskDate();
            //SetVision();
            monitorLog             = MonitorLog.NewMonitorLog();
            monitorLog.LOGNAME     = "系统信息";
            monitorLog.LOGINFO     = "补货监控系统启动!";
            monitorLog.LOGLOCATION = "系统";
            monitorLog.LOGTYPE     = 0;
            monitorLog.Save();
            //LoadDefaultLayout();
            SetDockWinTitle();
            SetLog(global::MonitorMain.Properties.Resources.StartUpTime + DateTime.Now);

            // Load Quick Access Toolbar layout if one is saved from last session...
            LoadQuickAccessToolbar();

            SetSeverStatus();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["IsStart"]))
            {
                buttonItem23.Checked = true;
                StartInTask();
                labtaskstatus.Text = "任务已启动";
            }
        }
示例#19
0
 /// <summary>
 /// 同一批次是否存在重复的顺序号
 /// </summary>
 /// <returns></returns>
 public static bool IsIndexRepetition()
 {
     using (var cn = new MySqlConnection(AppUtil._LocalConnectionString))
     {
         cn.Open();
         using (var cm = cn.CreateCommand())
         {
             cm.CommandText =
                 "SELECT INDEXNO,COUNT(1)  FROM t_sorting_line_task  GROUP BY  INDEXNO HAVING count(1)> 1";
             using (var dr = new SafeDataReader(cm.ExecuteReader()))
             {
                 while (dr.Read())
                 {
                     MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                     monitorLog.LOGNAME     = "数据库读取";
                     monitorLog.LOGINFO     = "当前分拣任务存在重复的顺序号,无法开始分拣!";
                     monitorLog.LOGLOCATION = "数据库";
                     monitorLog.LOGTYPE     = 2;
                     monitorLog.Save();
                     return(true);
                 }
             }
             return(false);
         }
     }
 }
示例#20
0
 public override Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
 {
     try
     {
         IHttpContextAccessor  httpContextAccessor  = AspectCoreContainer.CreateScope().Resolve <IHttpContextAccessor>();
         IMonitorLogRepository monitorLogRepository = AspectCoreContainer.CreateScope().Resolve <IMonitorLogRepository>();
         DateTime   time      = (DateTime)context.HttpContext.Items[key];
         var        request   = context.HttpContext.Request;
         var        headerStr = JsonConvert.SerializeObject(request.Headers);
         MonitorLog monLog    = new MonitorLog()
         {
             ExecuteStartTime = time,
             ExecuteEndTime   = DateTime.UtcNow,
             IP                 = httpContextAccessor.HttpContext.GetRequestIp4Address()?.ToString(),
             ClientAgent        = ((HttpRequestHeaders)((DefaultHttpRequest)request).Headers).HeaderUserAgent,
             Path               = (request.Path.HasValue ? request.Path.ToString() : "") + (request.QueryString.HasValue ? request.QueryString.ToString() : ""),
             ActionParams       = StreamHelper.GetStreamText(request.Body),
             HttpRequestHeaders = headerStr,
             HttpMethod         = request.Method,
             Response           = JsonConvert.SerializeObject(context.Result)
         };
         monLog.Elapsed = monLog.CostTime;
         monitorLogRepository.Insert(monLog);
         //Log4NetHelper.WriteDebug(GetType(), monLog.ToString());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     return(base.OnResultExecutionAsync(context, next));
 }
示例#21
0
        public static MailUserModel GetUser(HttpRequestBase request)
        {
            var model = new MailUserModel {
                IsAutharization = false
            };

            try
            {
                var userCookie = request.Cookies["mail_token"];
                if (userCookie != null)
                {
                    var stream = HttpTools.PostStream(InfoUrl,
                                                      string.Format("oauth_token={0}&client_id={1}&format=json&method=users.getInfo&sig={2}",
                                                                    userCookie.Value, SiteId, ""));
                    model = SerializeTools.Deserialize <MailUserModel>(stream);
                    model.IsAutharization = true;
                }
            }
            catch (Exception ex)
            {
                MonitorLog.WriteLog(ex.InnerException + ex.Message, MonitorLog.typelog.Error, true);
                model.IsAutharization = false;
            }

            return(model);
        }
示例#22
0
        /// <summary>
        /// 自动更新提示
        /// </summary>
        private void AutoCheckUpdateAlert()
        {
            if (!AppConfig.Instance().IsAutoCheckUpdate)
            {
                return;
            }

            var t = new Task(() =>
            {
                try
                {
                    var newversion = MonitorLog.GetNewVersion();
                    if (newversion > localversion)
                    {
                        if (MessageBox.Show(_rm.GetString("UpdateAlert")) == DialogResult.OK)
                        {
                            ShowUpdateLog(MonitorLog.GetUpdateLog());
                        }
                    }

                    AppConfig.Instance().LastCheckUpdate = _setting.LastCheckUpdate = DateTime.Now;
                    _setting.Save();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });

            t.Start();
        }
示例#23
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            monitorLog             = MonitorLog.NewMonitorLog();
            monitorLog.LOGNAME     = "系统信息";
            monitorLog.LOGINFO     = "分拣监控系统启动!";
            monitorLog.LOGLOCATION = "系统";
            monitorLog.LOGTYPE     = 0;
            monitorLog.Save();

            //LoadDefaultLayout();
            SetDockWinTitle();

            // Load Quick Access Toolbar layout if one is saved from last session...
            LoadQuickAccessToolbar();

            SetSeverStatus();
            //SetOutPort();
            if (Convert.ToBoolean(ConfigurationManager.AppSettings["IsStart"]))
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                config.AppSettings.Settings["IsStart"].Value = true.ToString();
                config.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection("appSettings");
                labtaskstatus.Text = "任务已启动";
                StartSorting();
            }

            //Thread thread = new Thread(SetVision);
            //thread.Start();
        }
        public IHttpActionResult PutMonitorLog(int id, MonitorLog monitorLog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != monitorLog.Id)
            {
                return(BadRequest());
            }

            db.Entry(monitorLog).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MonitorLogExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#25
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);
            }
        }
示例#26
0
        public int Save <T>(T entity) where T : Entity.Entity
        {
            int result;

            using (var session = Factory.OpenSession())
            {
                using (var tran = session.BeginTransaction())
                {
                    try
                    {
                        session.Save(entity);

                        tran.Commit();
                        result = entity.Id;
                    }
                    catch (Exception ex)
                    {
                        MonitorLog.WriteLog("Ошибка выполнения процедуры Save<" + typeof(T) + "> : " + ex.Message, MonitorLog.typelog.Error, true);
                        tran.Rollback();
                        result = 0;
                    }
                }
            }
            return(result);
        }
示例#27
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] });
        }
示例#28
0
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            MonitorLog MonLog = filterContext.Controller.ViewData[Key] as MonitorLog;

            MonLog.ExecuteEndTime = DateTime.Now;
            log.Info(MonLog.GetLoginfo(MonitorLog.MonitorType.View));
            filterContext.Controller.ViewData.Remove(Key);
        }
示例#29
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public LogHelper()
 {
     this._stopWatch = new Stopwatch();
     if (_monitorLog == null)
     {
         this._monitorLog = new MonitorLog();
     }
 }
示例#30
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);
        }