Beispiel #1
0
        /// <summary>
        /// NLogから呼ばれるUI向けログ出力
        /// </summary>
        /// <param name="dateTime">日付</param>
        /// <param name="level">ログレベル</param>
        /// <param name="callsite">callsite</param>
        /// <param name="message">メッセージ</param>
        public static void AppendLog(
            string dateTime,
            string level,
            string callsite,
            string message)
        {
            DateTime d;

            DateTime.TryParse(dateTime, out d);

            var entry = new AppLogEntry()
            {
                DateTime = d,
                Level    = level,
                CallSite = callsite,
                Message  = message,
            };

            lock (AppLog.locker)
            {
                if (AppLog.logBuffer.Count > LogBufferSize)
                {
                    AppLog.logBuffer.RemoveRange(0, LogBufferMargin);
                }

                AppLog.logBuffer.Add(entry);
            }

            WPFHelper.BeginInvoke(() =>
                                  AppLog.OnAppendedLog(new AppendedLogEventArgs(entry)));
        }
        public static bool IsAvailableWindows()
        {
            const string prompt1 = "Unsupported Operating System.";
            const string prompt2 = "Windows 10 or Later is Required.";

            var result = false;

            if (IsWindows10Later)
            {
                result = true;
            }
            else
            {
                if (Config.Instance.SupportWin7)
                {
                    result = true;

                    if (!shownWindowsIsOld)
                    {
                        shownWindowsIsOld = true;
                        Logger.Warn($"{prompt1} {prompt2}");
                        Logger.Warn($"Support Win7 manualy, but you'd better update to Windows 10. https://www.microsoft.com/software-download/windows10");
                    }
                }
                else
                {
                    if (!shownWindowsIsOld)
                    {
                        shownWindowsIsOld = true;
                        Logger.Error($"{prompt1} {prompt2}");
                        WPFHelper.BeginInvoke(
                            () => ModernMessageBox.ShowDialog(
                                $"{prompt1}\n{prompt2}",
                                "ACT.Hojoring"),
                            DispatcherPriority.Normal);
                    }
                }
            }

            return(result);
        }