Beispiel #1
0
        public Window1(Config appConfig)
        {
            InitializeComponent();
            configObj = appConfig;
            dataGrid1.ItemsSource = _configObj.imageLinks;
            dataGrid2.ItemsSource = _configObj.distributors;

            ArrayList knownColors = new ArrayList();
            foreach (KnownColor col in Enum.GetValues(typeof(KnownColor)))
            {
                System.Drawing.Color color = System.Drawing.Color.FromKnownColor(col);
                if (!color.IsSystemColor)
                {
                    knownColors.Add(col.ToString());
                }
            }

            ColorPicker.ItemsSource = knownColors;
            ColorPicker.SelectedIndex = knownColors.IndexOf(appConfig.contactColor);
        }
Beispiel #2
0
        /// <summary>
        /// Parse the serialized config object.  If the file doesn't exist then initialize it.
        /// </summary>
        private void parseConfig()
        {
            if (File.Exists("app_config.xml"))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(Config));
                TextReader tr = new StreamReader("app_config.xml");
                configuration = (Config)serializer.Deserialize(tr);
                tr.Close();
            }
            else
            {
                configuration = new Config();
                configuration.imageLinks = new List<ImageLink>();
                configuration.distributors = new List<Distributor>();
                configuration.contactColor = "Black";

                ImageLink link1 = new ImageLink();
                link1.prettyName = "Otter Brine, Inc.";
                link1.url = @"http://www.otterbine.com";
                link1.width = 58;
                link1.height = 40;
                link1.xStart = 9;
                link1.yStart = 733;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "Foley United";
                link1.url = @"http://www.foleyunited.com/Home";
                link1.width = 70;
                link1.height = 40;
                link1.xStart = 9;
                link1.yStart = 684;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "True Surface";
                link1.url = @"http://www.true-surface.com";
                link1.width = 87;
                link1.height = 40;
                link1.xStart = 100;
                link1.yStart = 684;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "Turf Care U.S.";
                link1.url = @"http://turfcare-us.lely.com/en/our-products/broadcast-spreader/land-wheel-wfr-en-wgr";
                link1.width = 60;
                link1.height = 40;
                link1.xStart = 84;
                link1.yStart = 733;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "Paraide";
                link1.url = @"http://www.paraide.com";
                link1.width = 46;
                link1.height = 40;
                link1.xStart = 174;
                link1.yStart = 733;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "Standard Gold";
                link1.url = @"http://www.standardgolf.com";
                link1.width = 90;
                link1.height = 40;
                link1.xStart = 198;
                link1.yStart = 684;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "SGM Industries";
                link1.url = @"http://www.sgmindustries.com/products";
                link1.width = 57;
                link1.height = 40;
                link1.xStart = 253;
                link1.yStart = 733;
                configuration.imageLinks.Add(link1);

                link1 = new ImageLink();
                link1.prettyName = "Echo";
                link1.url = @"http://www.echo-usa.com";
                link1.width = 104;
                link1.height = 29;
                link1.xStart = 302;
                link1.yStart = 684;
                configuration.imageLinks.Add(link1);

                Distributor dist1 = new Distributor();
                dist1.contactName = "Adam Tebbe";
                dist1.contactContact1 = "20 Pierce Rd., Watertown MA 02472";
                dist1.contactContact2 = "*****@*****.**";
                dist1.logo = @"C:\Users\Adam\Downloads\vw.jpg";
                dist1.name = "Me";
                configuration.distributors.Add(dist1);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Open the Edit form
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button3_Click(object sender, RoutedEventArgs e)
 {
     Window1 configWindow = new Window1(configuration);
     configWindow.ShowDialog();
     if (configWindow.DialogResult == true)
     {
         configuration = configWindow.configObj;
         saveConfig();
     }
 }