/// <summary> /// Get fresh info about Tasks from database and put them into TaskBox /// </summary> void RefreshTask() { dataObject.OpenConnection(); TaskBox.Items.Clear(); System.Data.SQLite.SQLiteDataReader data = dataObject.Select(filter, CCalendar.selectedDay.Month, CCalendar.selectedDay.Year); Tasks.Clear(); TaskBox.Items.Clear(); if (data != null && data.HasRows) { while (data.Read()) { Tasks.Add(new CustomButton(data)); } foreach (CustomButton b in Tasks) { if (!DayFilterOn || DayFilterOn && CCalendar.selectedDay.Day == b.deadline.Day) { TaskBox.Items.Add(b); } } } dataObject.CloseConnection(); CCalendar.UpdateCalendar(Tasks); }
/* * 选择文字大小 */ private void fontSize_SelectionChanged(object sender, RoutedEventArgs e) { ComboBox cbb = (ComboBox)sender; object obj = cbb.SelectedValue; if (obj == null) { return; } ComboBoxItem cbi = (ComboBoxItem)obj; string fontSizeText = cbi.Content.ToString(); int fontSizeVal = 0; if (fontSizeText != null && fontSizeText.EndsWith("像素")) { fontSizeText = fontSizeText.Replace("像素", ""); try { fontSizeVal = int.Parse(fontSizeText); } catch (Exception) { } } CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateFontSizeVal(content.Text, fontSizeVal); }
private void Form1_Load(object sender, EventArgs e) { //WindowsExitHelper.Lock(); CCalendar cal = new CCalendar(); this.tsslTips.Text = cal.GetDateInfo(System.DateTime.Now).Fullinfo; }
private void This_Close(object sender, EventArgs e) { //同步到页面 currElement.Tag = currDControl; CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateElement(currDControl, true); }
/* * 3.2插入日期 */ public void insertCCalendarToPage(DControl ctl) { CCalendar cCalendar = NewControlUtil.newCCalendar(ctl, dPage, App.localStorage.cfg); loadAllAnimation(cCalendar, ctl); mainContainer.Children.Add(cCalendar); cCalendar.Visibility = Visibility.Visible; }
private void Init() { //显示日期信息 CCalendar cal = new CCalendar(); this.lblCalendar.Caption = cal.GetDateInfo(System.DateTime.Now).Fullinfo; //TODO: 其他初始化工作 }
private void fontWeight_Checked(object sender, RoutedEventArgs e) { Boolean b = (Boolean)fontWeight.IsChecked; string fontWeightVal = "normal"; if (b) { fontWeightVal = "Bold"; } CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateFontWeightVal(content.Text, fontWeightVal); }
/* * 插入日期 */ internal void insertCCalendarToPage(DControl ctl) { CCalendar cCalendar = NewControlUtil.newCCalendar(ctl, pageTemplate.dPage, App.localStorage.cfg); cCalendar.Style = pageTemplate.container.TryFindResource("CCalendarStyle") as System.Windows.Style; //控件拖动 cCalendar.PreviewMouseLeftButtonDown += control_MouseDown; cCalendar.PreviewMouseMove += control_MouseMove; cCalendar.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 cCalendar.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(cCalendar); }
/// <summary> /// 开始的时候提示登录账号和密码 /// </summary> private void Logon_Load(object sender, EventArgs e) { ToolTip tp = new ToolTip(); tp.SetToolTip(this.cmbzhanhao, "首次登录的默认账号为:admin"); tp.SetToolTip(this.tbPass, "首次登录的默认密码为空, \r\n 以后请更改默认密码!"); CCalendar cal = new CCalendar(); this.lblCalendar.Text = cal.GetDateInfo(System.DateTime.Now).Fullinfo; AppConfig config = new AppConfig(); this.Text = config.AppName; this.lblTitle.Text = config.AppName; //ValidateRegisterStatus();//提示是否已经注册 if (this.cmbzhanhao.Text != "") { this.tbPass.Focus(); } else { this.cmbzhanhao.Focus(); } ValidateRegisterStatus(); #region 更新提示/判断是否自动更新 updateWorker = new BackgroundWorker(); updateWorker.DoWork += new DoWorkEventHandler(updateWorker_DoWork); updateWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(updateWorker_RunWorkerCompleted); string strUpdate = config.AppConfigGet("AutoUpdate"); if (!string.IsNullOrEmpty(strUpdate)) { bool autoUpdate = false; bool.TryParse(strUpdate, out autoUpdate); if (autoUpdate) { updateWorker.RunWorkerAsync(); } } #endregion }
/* * 对齐方式改变,更新到页面 */ private void fontTextAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox cbb = (ComboBox)sender; ComboBoxItem item = (ComboBoxItem)cbb.SelectedItem; if (item == null) { return; } object tag = item.Tag; int fontTextAlignmentVal = 0; if (tag != null) { fontTextAlignmentVal = Convert.ToInt32(tag); } CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateFontTextAlignment(content.Text, fontTextAlignmentVal); }
/* * 11 日期 */ public static CCalendar newCCalendar(DControl ctl, DPage dPage, Cfg appCfg) { CCalendar cCalendar = new CCalendar(ctl, dPage, appCfg); cCalendar.HorizontalAlignment = HorizontalAlignment.Left; cCalendar.VerticalAlignment = VerticalAlignment.Top; cCalendar.Margin = new Thickness(ctl.left, ctl.top, 0, 0); cCalendar.Width = ctl.width; cCalendar.Height = ctl.height; cCalendar.Background = Brushes.Transparent; cCalendar.Opacity = ctl.opacity / 100.0; Panel.SetZIndex(cCalendar, ctl.idx); cCalendar.Focusable = false; cCalendar.Tag = ctl; TransformGroup group = new TransformGroup(); cCalendar.RenderTransform = group; cCalendar.RenderTransformOrigin = new Point(0.5, 0.5); cCalendar.Visibility = Visibility.Visible; return(cCalendar); }
private void fontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox cbb = (ComboBox)sender; object obj = cbb.SelectedValue; if (obj == null) { return; } ComboBoxItem cbi = (ComboBoxItem)obj; string fontFamilyText = cbi.Content.ToString(); string fontFamilyVal = "宋体"; if (fontFamilyText != null) { fontFamilyVal = fontFamilyText; } CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateFontFamilyVal(content.Text, fontFamilyVal); }
private void Init() { CCalendar cal = new CCalendar(); this.lblCalendar.Caption = cal.GetDateInfo(System.DateTime.Now).Fullinfo; }
/* * 选择颜色 */ private void fontColor_TextChanged(string fontColorVal) { CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateFontColorVal(content.Text, fontColorVal); }
/// <summary> /// 开始的时候提示登录账号和密码 /// </summary> private void Logon_Load(object sender, EventArgs e) { ToolTip tp = new ToolTip(); tp.SetToolTip(this.cmbzhanhao, "首次登录的默认账号为:admin"); tp.SetToolTip(this.tbPass, "首次登录的默认密码为空, \r\n 以后请更改默认密码!"); CCalendar cal = new CCalendar(); this.lblCalendar.Text = cal.GetDateInfo(System.DateTime.Now).Fullinfo; AppConfig config = new AppConfig(); this.Text = config.AppName; this.lblTitle.Text = config.AppName; //ValidateRegisterStatus();//提示是否已经注册 if (this.cmbzhanhao.Text != "") { this.tbPass.Focus(); } else { this.cmbzhanhao.Focus(); } if (Portal.gc.EnableRegister) { //先处理用户的注册信息 Portal.gc.CheckRegister(); if (!Portal.gc.Registed) { this.lnkRegister.Visible = true; this.btLogin.ForeColor = Color.Red; ToolTip tip = new ToolTip(); tip.SetToolTip(this.btLogin, "软件未进行授权注册,不能使用。\r\n请单击【软件注册】按钮进行注册。"); Text += " [未注册]"; } else { this.lnkRegister.Visible = false; //Text += " [已注册]"; } } else { this.lnkRegister.Visible = false; } #region 更新提示/判断是否自动更新 updateWorker = new BackgroundWorker(); updateWorker.DoWork += new DoWorkEventHandler(updateWorker_DoWork); updateWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(updateWorker_RunWorkerCompleted); string strUpdate = config.AppConfigGet("AutoUpdate"); if (!string.IsNullOrEmpty(strUpdate)) { bool autoUpdate = false; bool.TryParse(strUpdate, out autoUpdate); if (autoUpdate) { updateWorker.RunWorkerAsync(); } } #endregion }
public void PageTemplate_UnLoaded(object sender, RoutedEventArgs e) { Unloaded -= PageTemplate_UnLoaded; foreach (FrameworkElement element in container.Children) { if (element is Button) { Button btn = element as Button; if (btn.Name == "Image") { btn.Click -= insertToPage.imageButtonClick; } else if (btn.Name == "BackButton") { btn.Click -= insertToPage.backButtonClick; } else if (btn.Name == "HomeButton") { btn.Click -= insertToPage.homeButtonClick; } btn.Background = null; btn = null; } else if (element is DocumentViewer) { DocumentViewer documentViewer = element as DocumentViewer; documentViewer.Document = null; documentViewer = null; } else if (element is TurnPicture) { TurnPicture turnPicture = element as TurnPicture; turnPicture = null; } else if (element is Marque) { Marque marque = element as Marque; marque = null; } else if (element is MarqueLayer) { MarqueLayer marqueLayer = element as MarqueLayer; marqueLayer = null; } else if (element is CVideo) { CVideo cVideo = element as CVideo; cVideo = null; } else if (element is CFrame) { CFrame cFrame = element as CFrame; cFrame.Content = null; cFrame = null; } else if (element is TextBlock) { TextBlock textBlock = element as TextBlock; textBlock.PreviewMouseUp -= insertToPage.textBlock_PreviewMouseUp; textBlock.PreviewTouchUp -= insertToPage.textBlock_PreviewTouchUp; textBlock = null; } else if (element is Gif) { Gif gif = element as Gif; gif.PreviewMouseUp -= insertToPage.gif_PreviewMouseUp; gif.PreviewTouchUp -= insertToPage.gif_PreviewTouchUp; gif = null; } else if (element is CAudio) { CAudio cAudio = element as CAudio; cAudio.PreviewMouseUp += insertToPage.cAudio_PreviewMouseUp; cAudio.PreviewTouchUp += insertToPage.cAudio_PreviewTouchUp; cAudio = null; } else if (element is CCalendar) { CCalendar cCalendar = element as CCalendar; cCalendar = null; } else if (element is Canvas && element.Name == "frameDialogCanvas") { releaseFrameDialogCanvas(element); } else { FrameworkElement fe = element as FrameworkElement; fe = null; } } //释放视频背景 foreach (FrameworkElement ele in backgroundVideo.Children) { if (ele.Name == "CVideoBackground") { CVideoBackground cVideoBackground = (CVideoBackground)ele; cVideoBackground = null; } } backgroundVideo.Children.Clear(); Background = null; insertToPage = null; Content = null; container.Children.Clear(); GC.Collect(); }
// private void Submit_Button_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(width.Text)) { MessageBox.Show("请填写宽度;"); return; } else if (!DataUtil.isInt(width.Text.ToString())) { MessageBox.Show("宽度必须是整数;"); return; } if (string.IsNullOrWhiteSpace(height.Text.ToString())) { MessageBox.Show("请填写高度;"); return; } else if (!DataUtil.isInt(height.Text.ToString())) { MessageBox.Show("高度必须是整数;"); return; } if (string.IsNullOrWhiteSpace(left.Text.ToString())) { MessageBox.Show("请填写左边距;"); return; } else if (!DataUtil.isInt(left.Text.ToString())) { MessageBox.Show("左边距请填写整数;"); return; } if (string.IsNullOrWhiteSpace(top.Text.ToString())) { MessageBox.Show("请填写上边距;"); return; } else if (!DataUtil.isInt(top.Text.ToString())) { MessageBox.Show("上边距请填写整数;"); return; } if (string.IsNullOrWhiteSpace(opacity.Text.ToString())) { MessageBox.Show("请填写透明度;"); return; } else if (!DataUtil.isInt(opacity.Text.ToString())) { MessageBox.Show("透明度请填写整数;"); return; } else { Int32 opacityVal = Convert.ToInt32(opacity.Text.ToString()); if (opacityVal < 0 || opacityVal > 100) { MessageBox.Show("透明度为0-100内的整数;"); return; } } //更新到数据库 DControl dControl = dControlBll.get(currDControl.id); dControl.width = int.Parse(width.Text); dControl.height = int.Parse(height.Text); dControl.left = int.Parse(left.Text); dControl.top = int.Parse(top.Text); dControl.opacity = int.Parse(opacity.Text); dControlBll.update(dControl); currDControl = dControl; currElement.Tag = currDControl; //更新页面控件信息 CCalendar cCalendar = (CCalendar)currElement; cCalendar.updateElementAttr(currDControl, true); editing.updateEditingBorder(dControl); Close(); }