Esempio n. 1
0
        /// <summary>
        /// 检测版本
        /// </summary>
        public void Check()
        {
            try
            {
                latestVersion = ProjectVersion.GetLatestVersion();
                localVersion  = ProjectVersion.GetLocalVersion();

                if (localVersion.BuildNumber < latestVersion.BuildNumber)
                {
                    mainWindow.Dispatcher.Invoke(new AskForUpdateEventHandler(AskForUpdate));
                }
                else
                {
                    if (!autoCheck)
                    {
                        mainWindow.Dispatcher.Invoke(ShowMessageBox, MessageBoxType.Infomation, "已经是最新版啦!");
                    }
                }
            }
            catch (WebException we)
            {
                if (!autoCheck)
                {
                    mainWindow.Dispatcher.Invoke(ShowMessageBox, MessageBoxType.Error, "检测新版本出现错误,请检查网络或稍后再试!");
                }
                App.writeLog.Error("检查版本失败", we);
            }
            catch (Exception ex)
            {
                App.writeLog.Error("检查版本失败", ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 插入帮助列表
        /// </summary>
        private void InsertHelpLists()
        {
            ListFamily whatsNewListFamily = new ListFamily
            {
                Title         = "最新更新 ",
                Detail        = ProjectVersion.GetLocalVersion().AssemblyVersion,
                DisplayWeight = listFamiliesDataTable.Rows.Count
            };

            ListFamily.AddListFamily(whatsNewListFamily);

            ListChild.AddListChild(new ListChild
            {
                Title         = "修复bug",
                Detail        = "",
                DisplayWeight = 0,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 6, 11, 52, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });

            ListChild.AddListChild(new ListChild
            {
                Title         = "细节调整",
                Detail        = "将设置按钮名称改为属性",
                DisplayWeight = 1,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 8, 9, 26, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });
            ListChild.AddListChild(new ListChild
            {
                Title         = "细节调整",
                Detail        = "在下方按钮中添加了上移和下移,方便移动",
                DisplayWeight = 1,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 8, 9, 30, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });

            ListChild.AddListChild(new ListChild
            {
                Title         = "功能增加",
                Detail        = "现在可以调整窗口大小了",
                DisplayWeight = 2,
                Mark          = MarkType.Finished,
                StartTime     = new DateTime(2013, 1, 8, 14, 50, 00),
                EndTime       = DateTime.MaxValue,
                FamilyId      = ListFamily.GetListFamilyByWeight(whatsNewListFamily.DisplayWeight).Id
            });

            ReadListFamiles();
            lstListFamilies.SelectedIndex = whatsNewListFamily.DisplayWeight;

            GenerateLocalXml();
        }
Esempio n. 3
0
 /// <summary>
 /// 判断是否第一次打开该版本
 /// </summary>
 /// <returns></returns>
 private bool FirstTimeOpen()
 {
     if (!File.Exists("localVersion.xml"))
     {
         return(true);
     }
     try
     {
         ProjectVersion lastVersion = ProjectVersion.Deserialize("localVersion.xml");
         if (lastVersion.BuildNumber < ProjectVersion.GetLocalVersion().BuildNumber)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         App.writeLog.Error("判断是否第一次打开失败!", ex);
         return(false);
     }
 }