Example #1
0
        private void BT_EditFont_Click(object sender, RoutedEventArgs e)
        {
            if (fontD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.Windows.Controls.Button button = (System.Windows.Controls.Button)sender;
                string target = button.Uid;

                FontGroup nfont = new FontGroup(fontD.Font);
                nfont.ApplyTo(button);

                switch (target)
                {
                case "NormalHomework":
                    SettingsManager.SetFont(FontTarget.NormalHomeworks, nfont);
                    break;

                case "Tests":
                    SettingsManager.SetFont(FontTarget.Tests, nfont);
                    break;

                case "Subjects":
                    SettingsManager.SetFont(FontTarget.subjects, nfont);
                    break;

                default:
                    throw new Exception(button.Name + " button Uid is not available"
                                        + Environment.NewLine + "UID = " + button.Uid);
                }
            }
        }
Example #2
0
 private void HideAdminButton(System.Windows.Controls.Button AdminButton)
 {
     if (currentUser.Id != 1) // ADMIN
     {
         AdminButton.Visibility = Visibility.Collapsed;
     }
 }
        /// <summary>
        /// 检查用户是否设置了内容以提交
        /// </summary>
        /// <param name="whatComboBox">ComboBox的源对象</param>
        private void CheckLastValue(System.Windows.Controls.ComboBox whatComboBox, TextBox whatTextBox, Paragraph whatParagraph, System.Windows.Controls.Button scbutton)
        {
            if (whatComboBox.SelectedIndex == -1 || whatComboBox.Text == "无任何内容")
            {
                System.Windows.Forms.MessageBox.Show("请设置类型以及时间..", "提示", MessageBoxButtons.OK);
                return;
            }

            // 判断触发按钮Content是"开始"还是"撤销"
            if ((string)scbutton.Content == "开始")
            {
                // 传递所需数据
                string time    = whatComboBox.Text.Split(new char[] { '|' })[0]; // 任务触发的时间
                bool   makeRst = new control_station.TaskTimingWindowControl().MakeTaskThread(scbutton, time, whatComboBox.Text, whatTextBox.Text, new TextRange(whatParagraph.ContentStart, whatParagraph.ContentEnd).Text);
                if (makeRst)
                {
                    scbutton.Content = "撤销"; // 此时用户可再次点击以撤销任务
                }
            }
            else
            {
                bool cancelRst = new control_station.TaskTimingWindowControl().CancelTheTaskThread(scbutton);
                if (cancelRst)
                {
                    scbutton.Content = "开始"; // 此时用户可从新设置任务以开始
                }
            }
        }