Exemplo n.º 1
0
        private void Grd1_Loaded(object sender, RoutedEventArgs e)
        {
            WindowHelpser.EnBlur(this.grd1);
            Inputbox i = new Inputbox();

            i.ShowDialog();
            double ret = Convert.ToDouble(i.Ret);

            full = (int)(ret * 36000);
        }
Exemplo n.º 2
0
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            _hotkey = new HotKey(ModifierKeys.Control | ModifierKeys.Alt, System.Windows.Forms.Keys.A, this);
            _hotkey.HotKeyPressed += (k) => new  ScreenCapture().Show();

            //bing每日截图
            //_hotkey = new HotKey(ModifierKeys.Control, System.Windows.Forms.Keys.L, this);
            //_hotkey.HotKeyPressed += (k) => new ScreenScene().Show();

            #region Layout

            this.Left = System.Windows.SystemParameters.PrimaryScreenWidth - this.ActualWidth - 10;
            this.Top  = 10;

            const int WS_EX_TOOLWINDOW = 0x00000080;
            SetWindowLongA(new WindowInteropHelper(this).Handle.ToInt32(), -20, WS_EX_TOOLWINDOW);



            #endregion
            #region 加载
            TimeSpan tt = DateTime.Now - new DateTime(2020, 2, 1);
            this.txt1.Text = "第" + ((int)tt.TotalDays / 7 + 1).ToString() + "周";
            grd1.Opacity   = 0;
            scv.ScrollToVerticalOffset(btn_timer.Height);

            Timer t = new Timer(500);
            t.Elapsed += (a, b) => {
                #region 失败的尝试
                //      string s = GetForeWinText();
                //;
                //      if (s == "MainWindow" || s == "Program Manager"||s=="") { this.Dispatcher.Invoke(() => { txt1.Text =this.IsVisible.ToString();   }); }
                //      else
                //      {

                //          this.Dispatcher.Invoke(() =>
                //          {
                //              txt1.Text = this.IsVisible.ToString();
                //              this.Topmost = false;

                //          });
                //      }
                #endregion

                this.Dispatcher.Invoke(
                    () =>
                {
                    txttime.Text = DateTime.Now.ToShortDateString();

                    if (WindowHelpser.GetForeWinText().Trim() == "" && WindowHelpser.GetWindowHeight() > 500)
                    {
                        // System.Threading.Thread.Sleep(300);
                        if (WindowHelpser.GetForeWinText().Trim() == "")
                        {
                            this.Show();
                            this.Topmost = true;
                            this.Topmost = false;
                        }
                    }
                }
                    );
            };
            t.Start();
            #endregion
            var      lst = File.ReadLines("info.thu");
            string[] s   = lst.ToArray();

            int n = 0;
            for (int i = 0; i < s.Length; i += 6)
            {
                events[++n].Name = s[i];
                events[n].Xingqi = int.Parse(s[i + 1]);

                events[n].StartTime = events[n].StartTime.AddHours(int.Parse(s[i + 2].Split(':')[0]));
                events[n].StartTime = events[n].StartTime.AddMinutes(int.Parse(s[i + 2].Split(':')[1]));
                events[n].EndTime   = events[n].EndTime.AddHours(int.Parse(s[i + 3].Split(':')[0]));
                events[n].EndTime   = events[n].EndTime.AddMinutes(int.Parse(s[i + 3].Split(':')[1]));
                events[n].Classroom = s[i + 4];
            }

            var ee = (from a in events where getxq(a.Xingqi) == (int)(DateTime.Now.DayOfWeek) select a);

            foreach (var item in ee)
            {
                EveItem eee = new EveItem();
                eee.Eventname = item.Name;
                eee.Eventtime = $"{item.StartTime.ToString("hh:mm")}~{item.EndTime.ToString("hh:mm")}";
                stk.Children.Add(eee);
                eee.Classroom = item.Classroom;
            }
        }