//definitions private void treeView_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { //if (!IsParent) return; if (e.Key == Key.Return) { WorkFlowScriptIDDataStore temp = (WorkFlowScriptIDDataStore)treeView.SelectedItem; if (temp.Place != 2) { return; } Textcategory_id.IsOpen = false; CatNameIDPair tempcat = new CatNameIDPair(temp.Name, temp.Id); bool flag = true; foreach (CatNameIDPair g in catlist) { if (g.Have(tempcat)) { flag = false; break; } } if (flag) { catlist.Add(tempcat); ListBoxCategory_id.ItemsSource = null; ListBoxCategory_id.ItemsSource = catlist; } } }
private void treeView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //if (!IsParent) return; try { WorkFlowScriptIDDataStore temp = (WorkFlowScriptIDDataStore)treeView.SelectedItem; if (temp.Place != 2) { return; } Textcategory_id.IsOpen = false; CatNameIDPair tempcat = new CatNameIDPair(temp.Name, temp.Id); bool flag = true; foreach (CatNameIDPair g in catlist) { if (g.Have(tempcat)) { flag = false; break; } } if (flag) { catlist.Add(tempcat); ListBoxCategory_id.ItemsSource = null; ListBoxCategory_id.ItemsSource = catlist; } } catch (Exception) { return; } }
public bool Have(CatNameIDPair temp) { if (temp.name == name && temp.id == id) { return(true); } return(false); }
public void LoadProductsData() { foreach (CarProduct c in Cars) { //IMPORTANT if (!c.AdId.Split(new string[] { "!#!" }, StringSplitOptions.None).ToList().Contains(ThisUniqueID)) { continue; } //Category List <string> tempID = new List <string>(); List <string> tempName = new List <string>(); tempName = c.category_name.Split(new string[] { ",,," }, StringSplitOptions.None).ToList(); tempID = c.category_id.Split(new string[] { "!#!" }, StringSplitOptions.None).ToList(); for (int i = 0; i < tempName.Count; i++) { if (tempName[i].Length == 0) { continue; } CatNameIDPair tempcat = new CatNameIDPair(tempName[i], tempID[i]); bool flag = true; foreach (CatNameIDPair g in catlist) { if (g.Have(tempcat)) { flag = false; break; } } if (flag) { catlist.Add(tempcat); } } //Photos foreach (string photo in c.photo.Split(new string[] { "!#!" }, StringSplitOptions.None).ToList()) { if (photolist.Contains(photo)) { continue; } if (photo == "") { continue; } photolist.Add(photo); } //photolist = c.photo.Split(new string[] { "!#!" }, StringSplitOptions.None).ToList(); //Vehicles //vehiclestorageList.AddRange(dts.ReadVehicleStorageID(Properties.Settings.Default.DBName, c.unique_id)); foreach (VehicleStorage temp in VehicleStorages.Where(vs => vs.unique_id == c.unique_id)) { bool flag = true; foreach (VehicleStorage g in vehiclestorageList) { if (g.Have(temp)) { flag = false; break; } } if (flag) { vehiclestorageList.Add(temp); } } //Products AdProducts.Add(c); } ListBoxCategory_id.ItemsSource = catlist; ListBoxCategory_id.DisplayMemberPath = "name"; ListBoxPhoto.ItemsSource = photolist; ListBoxMake.ItemsSource = vehiclestorageList; ListBoxMake.DisplayMemberPath = "readable"; ListBoxAd.ItemsSource = AdProducts; //try //{ // ListBoxAd.AutoGenerateColumns = false; // for (int i = 0; i < 23; i++) ListBoxAd.Columns[i].Visibility = Visibility.Collapsed; // ListBoxAd.Columns[0].Visibility = Visibility.Visible; // ListBoxAd.Columns[1].Visibility = Visibility.Visible; // ListBoxAd.Columns[6].Visibility = Visibility.Visible; //} //catch (Exception) //{ //} }