public Model.InitiativeValue GetInitiative()
        {
            string feedback = null;

            Model.InitiativeValue    initiativeValue = null;
            View.SetInitiativeWindow initDialog      = new View.SetInitiativeWindow(feedback);
            initDialog.DataContext = this;
            if (initDialog.ShowDialog() == true)
            {
                int score    = 0;
                int adjust   = 0;
                int modifier = 0;
                int roll     = 0;

                try
                {
                    score = Convert.ToInt32(Score);
                }
                catch (FormatException)
                {
                }

                try
                {
                    adjust = Convert.ToInt32(Adjust);
                }
                catch (FormatException)
                {
                }

                try
                {
                    modifier = Convert.ToInt32(Modifier);
                }
                catch (FormatException)
                {
                }

                try
                {
                    roll = Convert.ToInt32(Roll);
                }
                catch (FormatException)
                {
                }

                initiativeValue = new Model.InitiativeValue
                {
                    Score    = score,
                    Adjust   = adjust,
                    Modifier = modifier,
                    Roll     = roll,
                };
            }

            return(initiativeValue);
        }
示例#2
0
        public void OpenInitDialog(int actorInitMod)
        {
            SetInitiativeWindowViewModel setInitiativeWindowViewModel = new SetInitiativeWindowViewModel {
                Score    = InitiativeScore,
                Adjust   = InitiativeAdjust,
                Modifier = actorInitMod.ToString(),
                Roll     = InitiativeRoll,
            };

            Model.InitiativeValue initiativeValue = setInitiativeWindowViewModel.GetInitiative();
            if (initiativeValue != null)
            {
                InitiativeValue = initiativeValue;
            }
        }
示例#3
0
 public void ReadXML(XmlNode xmlNode)
 {
     InitiativeValue = new Model.InitiativeValue(xmlNode);
 }
示例#4
0
 public InitiativeValueViewModel()
 {
     _initiativeValue = new Model.InitiativeValue();
     _initiativeSet   = false;
 }