Esempio n. 1
0
        private void SpecTextBox_TextChanged(object sender, EventArgs e)
        {
            if (weights == null)
            {
                weights = new StatWeights();
            }

            weights.spec = SpecTextBox.Text;
        }
Esempio n. 2
0
        private void charTextBox_TextChanged(object sender, EventArgs e)
        {
            if (weights == null)
            {
                weights = new StatWeights();
            }

            weights.name = charTextBox.Text;
        }
Esempio n. 3
0
 public StatWeights(StatWeights weights)
 {
     this.name        = weights.name;
     this.server      = weights.server;
     this.intellect   = weights.intellect;
     this.haste       = weights.haste;
     this.mastery     = weights.mastery;
     this.crit        = weights.crit;
     this.versatility = weights.versatility;
     this.spec        = weights.spec;
 }
Esempio n. 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (weights == null)
            {
                weights = new StatWeights();
            }

            using (StatWeightWin statWin = new StatWeightWin())
            {
                statWin.setStatWeights(weights);
                statWin.ShowDialog();
            }
        }
Esempio n. 5
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (weights == null)
            {
                weights = new StatWeights();
            }

            serverTextBox.ResetText();
            serverTextBox.ReadOnly = false;
            charTextBox.ResetText();
            charTextBox.ReadOnly = false;
            SpecTextBox.ResetText();
            SpecTextBox.ReadOnly = false;
        }
Esempio n. 6
0
 private void loadToolStripMenuItem_Click(object sender, EventArgs e)
 {
     weights = StatWeights.LoadStatWeights();
     if (weights != null)
     {
         serverTextBox.Text     = weights.server;
         serverTextBox.ReadOnly = true;
         charTextBox.Text       = weights.name;
         charTextBox.ReadOnly   = true;
         SpecTextBox.Text       = weights.spec;
         SpecTextBox.ReadOnly   = true;
     }
     return;
 }
Esempio n. 7
0
        public static StatWeights LoadStatWeights()
        {
            StatWeights weights = new StatWeights();

            using (OpenFileDialog file = new OpenFileDialog())
            {
                file.Filter = "Stat files (*.stats)|*.stats| All files (*.*)|*.*";
                if (file.ShowDialog() == DialogResult.OK)
                {
                    String statData = System.IO.File.ReadAllText(file.FileName);
                    try
                    {
                        weights = JsonConvert.DeserializeObject <StatWeights>(statData);
                        return(weights);
                    }
                    catch
                    {
                        MessageBox.Show("Unable to load file. Confirm the file format and try again.");
                    }
                }
            }

            return(weights);
        }
Esempio n. 8
0
        private void setCurrentStatWeights()
        {
            var results = MessageBox.Show("No weights defined. Do you want to load from a file?", "Stat Weights", MessageBoxButtons.YesNoCancel,
                                          MessageBoxIcon.Question);

            if (results == DialogResult.Cancel)
            {
                return;
            }
            else if (results == DialogResult.No)
            {
                weights = new StatWeights();
            }
            else
            {
                using (OpenFileDialog file = new OpenFileDialog())
                {
                    if (file.ShowDialog() == DialogResult.OK)
                    {
                        String statData = System.IO.File.ReadAllText(file.FileName);
                        weights                = JsonConvert.DeserializeObject <StatWeights>(statData);
                        serverTextBox.Text     = weights.server;
                        serverTextBox.ReadOnly = true;
                        charTextBox.Text       = weights.name;
                        charTextBox.ReadOnly   = true;
                        SpecTextBox.Text       = weights.spec;
                        SpecTextBox.ReadOnly   = true;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            return;
        }
 internal void setStatWeights(StatWeights weights)
 {
     _weights = weights;
 }