private void On_BTN_CreateNew_Click(object sender, RoutedEventArgs e) { GirlInfoVM vm = new GirlInfoVM(new GirlInfo()); vm.Rare = 2; vm.ID = _girlColle.ElementAt(_girlColle.Count - 1).ID + 1; _girlColle.Add(vm); CMB_Girls.SelectedItem = vm; }
private void On_BTN_Next_Click(object sender, RoutedEventArgs e) { GirlInfoVM curSelVM = CMB_Girls.SelectedItem as GirlInfoVM; SQLiteCtrl.Data.InsertData(curSelVM.GetDataInfo()); if (CMB_Girls.SelectedIndex < _girlColle.Count - 1) { CMB_Girls.SelectedIndex++; } }
private void On_BTN_Prev_Click(object sender, RoutedEventArgs e) { GirlInfoVM curSelVM = CMB_Girls.SelectedItem as GirlInfoVM; SQLiteCtrl.Data.InsertData(curSelVM.GetDataInfo()); if (CMB_Girls.SelectedIndex > 0) { CMB_Girls.SelectedIndex--; } }
private void On_BTN_ChangeIcon_Click(object sender, RoutedEventArgs e) { GirlInfoVM vm = CMB_Girls.SelectedItem as GirlInfoVM; using (System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog()) { dlg.Title = "Open Image"; dlg.Filter = "Image files (*.BMP;*.JPG;*.PNG)|*.BMP;*.JPG;*.Png|All files (*.*)|*.*"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { vm.ImgBase64 = GirlInfo.ImgFileToBase64(dlg.FileName); } } }
public MainWindow() { InitializeComponent(); SQLiteCtrl.Data.Init(); Task.Factory.StartNew(() => { _girls = SQLiteCtrl.Data.LoadData(); foreach (GirlInfo info in _girls) { GirlInfoVM vm = new GirlInfoVM(info); _girlColle.Add(vm); } ObservableCollection <GirlInfoEnum.Types> typeColle = new ObservableCollection <GirlInfoEnum.Types>(); foreach (GirlInfoEnum.Types item in Enum.GetValues(typeof(GirlInfoEnum.Types))) { if (item != GirlInfoEnum.Types.NotCare) { typeColle.Add(item); } } ObservableCollection <GirlInfoEnum.Nationalities> nationalColle = new ObservableCollection <GirlInfoEnum.Nationalities>(); foreach (GirlInfoEnum.Nationalities item in Enum.GetValues(typeof(GirlInfoEnum.Nationalities))) { if (item != GirlInfoEnum.Nationalities.NotCare) { nationalColle.Add(item); } } App.Current.Dispatcher.Invoke(() => { CMB_Type.ItemsSource = typeColle; CMB_Nationality.ItemsSource = nationalColle; CMB_Girls.ItemsSource = _girlColle; CMB_Girls.SelectedIndex = 0; }); }); }