Example #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Loading()
        {
            #region 温馨提示

            Service.Calendar calender = new Service.Calendar(DateTime.Now);
            string           calendar = "农历:" + calender.ChineseDateString + "\r\n";
            calendar += " 时辰:" + calender.ChineseHour + "\r\n";
            calendar += " 属相:" + calender.AnimalString + "\r\n";
            calendar += (calender.ChineseTwentyFourDay.Length > 0) ? " 节气:" + calender.ChineseTwentyFourDay + "\r\n" : "";
            calendar += (calender.DateHoliday.Length > 0) ? " 节日:" + calender.DateHoliday + "\r\n" : "";
            calendar += " 星座:" + calender.Constellation + "\r\n";

            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                View.PopUP pop = new View.PopUP();
                pop.Subject    = "";
                pop.Info       = calendar;
                pop.PopTitle   = "温馨提示!";
                pop.Show();
            }));
            #endregion

            #region 异步

            //var action = new Action(() =>
            //{
            //    //删除4天前日志文件
            //    Bll.SysLog taskLog = new Bll.SysLog();
            //    Helper.Instance.DropFiles(Log.LogPath, null, new string[] { ".txt", ".log" }, 4);
            //    taskLog.DeleteHistory();
            //    this.Verson = "版本 V" + Helper.Instance.GetVersion();
            //});
            //action.BeginInvoke(ar =>
            //{
            //    action.EndInvoke(ar);
            //}, null);
            #endregion

            //System.Threading.Tasks.Task.Factory.StartNew(() =>
            //{

            //});
            Bll.SysLog taskLog = new Bll.SysLog();
            Helper.Instance.DropFiles(Log.LogPath, null, new string[] { ".txt", ".log" }, 4);//删除4天前日志文件
            taskLog.DeleteHistory();
            this.Verson = "版本 V" + Helper.Instance.GetVersion();

            Task.Instance.GetTaskList(true);
            Helper.Instance.CreateFolder(Log.LogPath);
            _xml = new XmlHelper(TimedTask.Model.PM.TaskConfig);

            TimedTask.Model.Area area = this._balWeather.GetCurrentArea();

            if (area != null)
            {
                AsyncWeather(area.Name);
            }
        }
Example #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            strListx = new List <string>();
            strListy = new List <string>();
            //Simon.Children.Clear();
            this._info = "";
            this._dic  = new Dictionary <string, string>();

            Service.Calendar calender = new Service.Calendar(DateTime.Now);
            if (calender.ChineseTwentyFourDay.Length > 0)
            {
                this._info += "今天是:" + calender.ChineseTwentyFourDay + "\r\n\r\n";
            }
            if (calender.NextDateHoliday.Length > 0)
            {
                this._info += calender.NextDateHoliday.Split('|')[1] + "是:" + calender.NextDateHoliday.Split('|')[0] + "\r\n\r\n";
            }

            this._dic.Add("记事", this._bllNote.Count(" 1=1 ").ToString());
            this._dic.Add("定时任务", this._bllTask.Count(" TaskType=0 ").ToString());
            this._dic.Add("定时提醒", this._bllTask.Count(" TaskType=1 ").ToString());
            this._dic.Add("定时关机", this._bllTask.Count(" TaskType=2 ").ToString());
            this._dic.Add("关显示器", this._bllTask.Count(" TaskType in(3,4) ").ToString());
            this._dic.Add("定时锁屏", this._bllTask.Count(" TaskType=5 ").ToString());

            if (this._dic.Count > 0)
            {
                foreach (KeyValuePair <string, string> kvp in this._dic)
                {
                    strListx.Add(kvp.Key);
                    strListy.Add(kvp.Value.ToString());
                    this._info += "您有" + kvp.Key + " " + kvp.Value + " 条\r\n\r\n";
                }
            }
            this.txtStatistical.Text = this._info;

            #region 记事类别

            using (DataTable dt = new Bll.TypeList().GetDataTable(" FatherId=1 ", "Id,Name", "Id"))
            {
                Model.PM.NoteTypeHt = new System.Collections.Hashtable();
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Model.PM.NoteTypeHt.Add(dr["Id"], dr["Name"]);
                    }
                }
            }
            #endregion

            string path = Model.PM.StartPath + "\\News\\news.htm";
            //this.browerNews.Navigate(new Uri(path, UriKind.Absolute));
            //// 将当前类设置为可由脚本访问
            //this.browerNews.ObjectForScripting = this;

            //System.Windows.Controls.WebBrowser webBrowser1 = new System.Windows.Controls.WebBrowser();
            //webBrowser1.Name = "webBrowser1";
            //webBrowser1.Width = 200;
            //webBrowser1.Height=200;
            //this.Simon.Children.Add(webBrowser1);

            //webBrowser1.Navigate(new Uri("http://www.baidu.com/"));
            //webBrowser1.SuppressScriptErrors(true);

            //添加事件响应代码
        }