コード例 #1
0
 // This could be used down the road if the default images don't line up correctly
 // It makes use of the WriteableBitmapEx method BLIT()
 //public Image ProfileImage
 //{
 //    get
 //    {
 //        List<WriteableBitmap> images = new List<WriteableBitmap>();
 //        if (Outer.Image != null) images.Add(new WriteableBitmap(Outer.Image));
 //        if (Inner.Image != null) images.Add(new WriteableBitmap(Inner.Image));
 //        if (Panel.Image != null) images.Add(new WriteableBitmap(Panel.Image));
 //        WriteableBitmap destBitmap = new WriteableBitmap(300, 50);
 //        double x = 0;
 //        double y = 0;
 //        foreach (var item in images)
 //        {
 //            destBitmap.Blit(new Rect(x, y, item.PixelWidth, item.PixelHeight), item, new Rect(x, y, item.PixelWidth, item.PixelHeight));
 //            x += item.PixelWidth;
 //        }
 //        Image image = new Image();
 //        image.Source = destBitmap;
 //        return image;
 //    }
 //}
 private void PopulatePanelFO(bool isfo)
 {
     if (isfo)
     {
         Panels.ToList().ForEach(delegate(IParameter paneltorem)
         {
             Panels.Remove(paneltorem);
         });
         FOPanels.ToList().ForEach(delegate(IParameter parm)
         {
             Panels.Add(parm);
         });
     }
     else
     {
         PopulatePanels();
     }
     if (panel == null)
         panel = Panels[0] as Kendor_Website.Model.Panel;
     RaisePropertyChanged("Panel");
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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");
        }