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

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

            weights.name = charTextBox.Text;
        }
Exemplo 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;
 }
Exemplo 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();
            }
        }
Exemplo 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;
        }
Exemplo 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;
 }
Exemplo 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);
        }
Exemplo 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;
 }