private void btnClear_Click(object sender, EventArgs e) { TBTitle.Clear(); TBWriter.Clear(); CBGenre.Text = ""; CBDate.Text = ""; CBRank.Text = ""; }
private void InitTitle() { string resKey = $"ExtensionsPanel{TargetDeviceState.ToString()}"; if (TryFindResource(resKey) != null) { TBTitle.SetResourceReference(TextBlock.TextProperty, resKey); } else { TBTitle.SetResourceReference(TextBlock.TextProperty, "ExtensionsPanelNoMatter"); } }
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e) { string resKey = $"PanelExtensionsWhenCurrentDevice{TargetDeviceState.ToString()}"; if (TryFindResource(resKey) != null) { TBTitle.SetResourceReference(TextBlock.TextProperty, resKey); } else { TBTitle.SetResourceReference(TextBlock.TextProperty, "PanelExtensionsWhenCurrentDeviceNoMatter"); } (DataContext as VMExtensions)?.Load(TargetDeviceState); }
private void CBType_SelectedIndexChanged(object sender, EventArgs e) { if (CBType.SelectedIndex == 0 || CBType.SelectedIndex == 2 || CBType.SelectedIndex == 5) { CBTitle.Enabled = false; TBTitle.Enabled = false; TBTitle.Clear(); CBTitle.Items.Clear(); return; } CBTitle.Enabled = true; CBTitle.Enabled = true; InitializeChapSub(); }
private void ADD_Click(object sender, RoutedEventArgs e) { //по нажаьтию кнопки проверяем есть ли ткое название в базе если нет то добавляем MContext mc = new MContext(); if (mc.Subcategories.Any(x => x.Name == TBTitle.Text)) { MessageBox.Show("Подкатегория {0} уже существует", TBTitle.Text); TBTitle.Text = string.Empty; TBTitle.Focus(); } else { Category c = CBCategory.SelectedItem as Category; PriceFormat pf = CBFP.SelectedItem as PriceFormat; Subcategory s = new Subcategory() { Name = TBTitle.Text, ID_Category = c.ID, UrlComfy = Comfy.Text, UrlAllo = Allo.Text, UrlEldorado = Eldorado.Text, UrlRozetka = Rozetka.Text, ID_PriceFormat = pf.ID }; mc.Subcategories.Add(s); mc.SaveChanges(); AnotSubCat asc = new AnotSubCat() { ID = s.ID, Har1 = Value1.Text, Har2 = Value2.Text, Har3 = Value3.Text, Har4 = Value4.Text, Har5 = Value5.Text, Har6 = Value6.Text, Har7 = Value7.Text, Har8 = Value8.Text, Har9 = Value9.Text, Har10 = Value10.Text, Har11 = Value11.Text, Har12 = Value12.Text, }; mc.ASCs.Add(asc); mc.SaveChanges(); MessageBox.Show("Подкатегория добавлена"); this.Close(); } }
// CHAP:SUB Functions private void InitializeChapSub() { try { CBTitle.Items.Clear(); TBTitle.Clear(); foreach (string shapeName in A3Environment.A3SLIDE.ShapeNames) { CBTitle.Items.Add(shapeName); } int index = A3Environment.A3SLIDE.ShapeNames.FindIndex(s => s == "CHAP:SUB") > 0 ? A3Environment.A3SLIDE.ShapeNames.FindIndex(s => s == "CHAP:SUB") : 0; CBTitle.SelectedIndex = index; try { TBTitle.Text = A3Environment.A3SLIDE.Slide.Shapes[CBTitle.SelectedItem].TextFrame.TextRange.Text; } catch { } } catch { } }