private void DataViewer_MouseUp(object sender, MouseButtonEventArgs e) { if (DV_Selected != null) { (DV_Selected.Parent as Grid).Background = new SolidColorBrush(Color.FromArgb(0x02, 0xff, 0xff, 0xff)); } (sender as Grid).Background = new SolidColorBrush(Color.FromArgb(0xcc, 0xb2, 0xb2, 0xb2)); DV_Selected = ((sender as Grid).Children[0] as DataViewer); int id = -1; foreach (List <string> item in Settings.Instance.DataViewSelected) { if (item != null && item[0] == DV_Selected.DataMode[0] && item[1] == DV_Selected.DataMode[1]) { id = Settings.Instance.DataViewSelected.IndexOf(item); break; } } ST_Block_LT.Background = id == 0 ? new SolidColorBrush(Color.FromArgb(0xcc, 0xb2, 0xb2, 0xb2)) : new SolidColorBrush(Color.FromArgb(0x02, 0xff, 0xff, 0xff)); ST_Block_RT.Background = id == 1 ? new SolidColorBrush(Color.FromArgb(0xcc, 0xb2, 0xb2, 0xb2)) : new SolidColorBrush(Color.FromArgb(0x02, 0xff, 0xff, 0xff)); ST_Block_LB.Background = id == 2 ? new SolidColorBrush(Color.FromArgb(0xcc, 0xb2, 0xb2, 0xb2)) : new SolidColorBrush(Color.FromArgb(0x02, 0xff, 0xff, 0xff)); ST_Block_RB.Background = id == 3 ? new SolidColorBrush(Color.FromArgb(0xcc, 0xb2, 0xb2, 0xb2)) : new SolidColorBrush(Color.FromArgb(0x02, 0xff, 0xff, 0xff)); }
private void DataViewer_MouseUp(object sender, MouseButtonEventArgs e) { if (DV_Selected != null) { DV_Selected.Background = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff)); } ; DataViewer s = sender as DataViewer; s.Background = new SolidColorBrush(Color.FromArgb(0x66, 0xff, 0xff, 0xff)); DV_Selected = sender as DataViewer; lbl_DataTitle.Content = GetDataTile(s.DataMode); JObject obj = JObject.Parse(Properties.Resources.DataDesc); TBK_DataDesc.Text = obj[s.DataMode[0]][s.DataMode[1]].ToString(); ST_Block1.Background = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff)); ST_Block2.Background = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff)); ST_Block3.Background = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff)); ST_Block4.Background = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff)); int id = -1; foreach (string[] item in Bas.settings.DataViewSelected) { if (item != null && item[0] == s.DataMode[0] && item[1] == s.DataMode[1]) { id = Bas.settings.DataViewSelected.IndexOf(item); break; } } switch (id) { case 0: ST_Block1.Background = new SolidColorBrush(Color.FromArgb(0x66, 0xff, 0xff, 0xff)); break; case 1: ST_Block2.Background = new SolidColorBrush(Color.FromArgb(0x66, 0xff, 0xff, 0xff)); break; case 2: ST_Block3.Background = new SolidColorBrush(Color.FromArgb(0x66, 0xff, 0xff, 0xff)); break; case 3: ST_Block4.Background = new SolidColorBrush(Color.FromArgb(0x66, 0xff, 0xff, 0xff)); break; default: break; } }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { DV_Selected = null; SettingBox.Children.Clear(); OverallTab.Children.Clear(); VideoTab.Children.Clear(); ArticleTab.Children.Clear(); BindingOperations.ClearAllBindings(TBN_RealMode); BindingOperations.ClearAllBindings(TB_RefreshInterval); }
/// <summary> /// 更新展示 /// </summary> public void ChangeView() { if (BiliUPData.Intance != null) { DataViewer[] viewers = new DataViewer[4] { ViewerLT, ViewerRT, ViewerLB, ViewerRB }; for (int i = 0; i < viewers.Length; i++) { viewers[i].Title = GetDataTile(Settings.Instance.DataViewSelected[i]); viewers[i].DataMode = Settings.Instance.DataViewSelected[i]; } } }
/// <summary> /// 更新展示 /// </summary> public void ChangeView() { if (Bas.biliupdata != null) { DataViewer[] viewers = new DataViewer[4] { ViewerLT, ViewerRT, ViewerLB, ViewerRB }; for (int i = 0; i < viewers.Length; i++) { viewers[i].Title = GetDataTile(Bas.settings.DataViewSelected[i]); viewers[i].DataMode = Bas.settings.DataViewSelected[i]; } } }
public static void ChangeView(DependencyObject sender, DependencyPropertyChangedEventArgs e) { DataViewer r = (DataViewer)sender; Binding binding_num, binding_incr; string[] value = e.NewValue as string[]; if (value != null && value.Length == 3) { switch (value[0]) { case "video": binding_num = new Binding() { Source = Bas.biliupdata.video, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[1]) }; binding_incr = new Binding() { Source = Bas.biliupdata.video, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[2]) }; BindingOperations.SetBinding(r.num, RollingNums.numProperty, binding_num); BindingOperations.SetBinding(r.incr, RollingNums.numProperty, binding_incr); break; case "article": binding_num = new Binding() { Source = Bas.biliupdata.article, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[1]) }; binding_incr = new Binding() { Source = Bas.biliupdata.article, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[2]) }; BindingOperations.SetBinding(r.num, RollingNums.numProperty, binding_num); BindingOperations.SetBinding(r.incr, RollingNums.numProperty, binding_incr); break; default: BindingOperations.ClearAllBindings(r.num); BindingOperations.ClearAllBindings(r.incr); break; } r.Visibility = Visibility.Visible; } else if (value != null) { BindingOperations.ClearAllBindings(r.num); BindingOperations.ClearAllBindings(r.incr); r.Visibility = Visibility.Visible; } else { r.Visibility = Visibility.Hidden; } }
public static void ChangeView(DependencyObject sender, DependencyPropertyChangedEventArgs e) { DataViewer r = (DataViewer)sender; Binding binding_num, binding_incr; List <string> value = e.NewValue as List <string>; if (value.Count > 3) { value.RemoveRange(0, value.Count - 3); } if (value != null && value.Count == 3) { switch (value[0]) { case "video": binding_num = new Binding() { Source = BiliUPData.Intance.video, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[1]) }; binding_incr = new Binding() { Source = BiliUPData.Intance.video, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[2]) }; BindingOperations.SetBinding(r.num, RollingNums.numProperty, binding_num); BindingOperations.SetBinding(r.incr, RollingNums.numProperty, binding_incr); break; case "article": binding_num = new Binding() { Source = BiliUPData.Intance.article, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[1]) }; binding_incr = new Binding() { Source = BiliUPData.Intance.article, Mode = BindingMode.TwoWay, Path = new PropertyPath(value[2]) }; BindingOperations.SetBinding(r.num, RollingNums.numProperty, binding_num); BindingOperations.SetBinding(r.incr, RollingNums.numProperty, binding_incr); break; default: BindingOperations.ClearAllBindings(r.num); BindingOperations.ClearAllBindings(r.incr); break; } r.Visibility = Visibility.Visible; } else if (value != null) { BindingOperations.ClearAllBindings(r.num); BindingOperations.ClearAllBindings(r.incr); r.Visibility = Visibility.Visible; } else { r.Visibility = Visibility.Hidden; } }