private void CheckMDFSpecies(string speciesName) { if (speciesName == "mdf") { Outers.Add(new Outer { Name = "MDF A", ParmName = "MDFA", Image = new BitmapImage(new System.Uri(@"../Outer/outer_A.png", UriKind.Relative)) }); Outers.Add(new Outer { Name = "MDF F", ParmName = "MDFF", Image = new BitmapImage(new System.Uri(@"../Outer/outer_A.png", UriKind.Relative)) }); outer = Outers[0] as Outer; RaisePropertyChanged("Outer"); } else { var outersToRemove = from outs in Outers where outs.ParmName == "MDFF" || outs.ParmName == "MDFA" select outs; if (outersToRemove.Count() > 0) outersToRemove.ToList().ForEach(delegate(IParameter parm) { Outers.Remove(parm); }); } }
public void PopulateDoorImages(Action action) { var url = "http://kendorwood.com/Doors/imgListing.php"; //var url = "http://kendorwood.ctg4u.com/site/ClientBin/Doors/imgListing.php"; var wc = new WebClient(); wc.DownloadStringCompleted += (object sender, DownloadStringCompletedEventArgs e) => { char[] charSeparators = new char[] { ',' }; var directories = e.Result.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries); directories.ToList().ForEach(delegate(string s) { var parms = s.Split('_'); var specieToAdd = (from species in this.Species where species.ParmName == parms[0] select species).SingleOrDefault(); if (specieToAdd == null) specieToAdd = new Species() { Name = parms[0], ParmName = parms[0] }; var innerToUse = (from inner in this.Inners where inner.ParmName == parms[1] select inner).FirstOrDefault(); var outerToUse = (from outer in this.Outers where outer.ParmName == parms[2] select outer).FirstOrDefault(); var panelToUse = (from panel in this.Panels where panel.ParmName == parms[3] select panel).FirstOrDefault(); if (innerToUse == null) innerToUse = new Inner { Name = "" }; if (outerToUse == null) outerToUse = new Outer { Name = "" }; if (panelToUse == null) panelToUse = new Kendor_Website.Model.Panel { Name = "" }; var moulding = Mouldings.One; if (parms.Count() == 6) { if (parms[5] == "2" || parms[5] == "24") moulding = Mouldings.One; else moulding = Mouldings.Two; } var mouldingSize = "2 1/4" + "\""; switch (parms[5]) { case "2": mouldingSize = "2 " + "\""; break; case "24": mouldingSize = "2 1/4" + "\""; break; case "3": mouldingSize = "3" + "\""; break; case "VARIED": mouldingSize = "Varied"; break; case "NONE": mouldingSize = ""; break; default: mouldingSize = "2 1/4" + "\""; break; } DoorImages.Add(new DoorImage() { ImageLocation = "../Doors/" + s + "/dzc_output.xml", ThumbNailLocation = "../Doors/" + s + "/door.jpg", Species = specieToAdd, Inner = new Inner() { Name = innerToUse.Name, ParmName = innerToUse.ParmName, Image = innerToUse.Image } , Outer = new Outer() { Name = outerToUse.Name, ParmName = outerToUse.ParmName, Image = outerToUse.Image }, Panel = new Kendor_Website.Model.Panel() { Name = panelToUse.Name, ParmName = panelToUse.ParmName, Image = panelToUse.Image }, Style = new Kendor_Website.Model.Style() { Name = parms[4], ParmName = parms[4] }, Moulding = moulding, MouldingSize = mouldingSize }); }); action(); }; wc.DownloadStringAsync(new Uri(url)); }
private void CCLogic() { //This method is a massive hack to just get paid really. //It needs to be pushed off to the DoorImageFactory to get the correct //parameters, if they want us to revisit this for more $$$$ if (Outer.ParmName != "CC") { outer = Outers[4] as Outer; RaisePropertyChanged("Outer"); } if (Inner.ParmName != "CC" && Inner.ParmName != "CCROPE") { inner = Inners[4] as Inner; RaisePropertyChanged("Inner"); } SetMouldingDisplay(true); panel = Panels[0] as Kendor_Website.Model.Panel; RaisePropertyChanged("Panel"); spacer = Spacers[1] as Spacer; RaisePropertyChanged("Spacer"); }