private void SpecTextBox_TextChanged(object sender, EventArgs e) { if (weights == null) { weights = new StatWeights(); } weights.spec = SpecTextBox.Text; }
private void charTextBox_TextChanged(object sender, EventArgs e) { if (weights == null) { weights = new StatWeights(); } weights.name = charTextBox.Text; }
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; }
private void button2_Click(object sender, EventArgs e) { if (weights == null) { weights = new StatWeights(); } using (StatWeightWin statWin = new StatWeightWin()) { statWin.setStatWeights(weights); statWin.ShowDialog(); } }
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; }
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; }
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); }
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; }