public void clear_file()
 {
     Options = new Opciones();
     Series.Clear();
     FileName = "";
     FilePath = "";
     LastId   = 1;
 }
        public void load_file(String path)
        {
            XmlSerializer reader = new XmlSerializer(typeof(Archivo));
            StreamReader  file   = new StreamReader(path);

            try
            {
                Archivo loadedFile = (Archivo)reader.Deserialize(file);
                FilePath = loadedFile.FilePath;
                FileName = getFileName(FilePath);
                LastId   = loadedFile.LastId;
                Options  = loadedFile.Options;
                Series   = loadedFile.Series;
            } catch (Exception ex)
            {
                MessageBox.Show("Sorry, there was a problem loading the file. It might be corrupted.\n\nError message: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            file.Close();
        }
Beispiel #3
0
        public Opciones Clone()
        {
            Opciones clonedOptions = new Opciones();

            clonedOptions.DisplayStyle         = DisplayStyle;
            clonedOptions.GridColor            = GridColor;
            clonedOptions.GridStyle            = GridStyle;
            clonedOptions.GridSpacing          = GridSpacing;
            clonedOptions.TickVisible          = TickVisible;
            clonedOptions.LegendVisible        = LegendVisible;
            clonedOptions.LegendLocation       = LegendLocation;
            clonedOptions.CompoundA            = CompoundA;
            clonedOptions.CompoundB            = CompoundB;
            clonedOptions.CompoundC            = CompoundC;
            clonedOptions.CompoundTextLocation = CompoundTextLocation;
            clonedOptions.FontFamily           = FontFamily;
            clonedOptions.FontSize             = FontSize;
            //clonedOptions.Font = Font;
            clonedOptions.BackgroundColor   = BackgroundColor;
            clonedOptions.BackgroundPicture = BackgroundPicture;

            return(clonedOptions);
        }
        public void RefreshData()
        {
            Opciones opt = Father.CurrentFile.Options;

            if (opt.DisplayStyle == DispStyle.Equilateral)
            {
                button1.BackColor = SystemColors.Highlight;
                button2.BackColor = SystemColors.Control;
            }
            else
            {
                button1.BackColor = SystemColors.Control;
                button2.BackColor = SystemColors.Highlight;
            }

            if (opt.LegendVisible == true)
            {
                button3.BackColor = SystemColors.Highlight;
            }
            else
            {
                button3.BackColor = SystemColors.Control;
            }

            if (opt.TickVisible == true)
            {
                button7.BackColor = SystemColors.Highlight;
            }
            else
            {
                button7.BackColor = SystemColors.Control;
            }

            if (opt.CompoundTextLocation == CompoundTxtLocation.Top)
            {
                button4.BackColor  = SystemColors.Highlight;
                button5.BackColor  = SystemColors.Control;
                button11.BackColor = SystemColors.Control;
            }
            else if (opt.CompoundTextLocation == CompoundTxtLocation.Side)
            {
                button4.BackColor  = SystemColors.Control;
                button5.BackColor  = SystemColors.Highlight;
                button11.BackColor = SystemColors.Control;
            }
            else
            {
                button4.BackColor  = SystemColors.Control;
                button5.BackColor  = SystemColors.Control;
                button11.BackColor = SystemColors.Highlight;
            }

            if (opt.BackgroundPicture == null)
            {
                button10.BackColor = SystemColors.Highlight;
                button9.BackColor  = SystemColors.Control;
            }
            else
            {
                button10.BackColor = SystemColors.Control;
                button9.BackColor  = SystemColors.Highlight;
            }

            /*if (opt.BackgroundStyle == BackgndStyle.Transparent)
             * {
             *  button10.BackColor = SystemColors.Highlight;
             *  button8.BackColor = SystemColors.Control;
             *  button9.BackColor = SystemColors.Control;
             * }
             *
             * else if (opt.BackgroundStyle == BackgndStyle.Color)
             * {
             *  button10.BackColor = SystemColors.Control;
             *  button8.BackColor = SystemColors.Highlight;
             *  button9.BackColor = SystemColors.Control;
             * }
             * else
             * {
             *  button10.BackColor = SystemColors.Control;
             *  button8.BackColor = SystemColors.Control;
             *  button9.BackColor = SystemColors.Highlight;
             * }*/

            if (color_src.Exists(x => x == opt.GridColor))
            {
                comboBox2.SelectedIndex = color_src.FindIndex(x => x == opt.GridColor);
            }
            else
            {
                InsertColorComboBox(Color.FromArgb(opt.GridColor));
            }

            comboBox3.SelectedIndex = spacing_src.ToList().IndexOf(opt.GridSpacing);
            comboBox1.SelectedIndex = (int)opt.GridStyle;

            textBox1.Text = opt.CompoundA;
            textBox2.Text = opt.CompoundB;
            textBox3.Text = opt.CompoundC;
        }