Beispiel #1
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            //Cache the parentform prior to deletion, otherwise the relationship is broken.
            Form frmParent = ParentForm;

            if (PowerObject.FreeLevels > 0)
            {
                string strImprovementSourceName = PowerObject.CharacterObject.Improvements.FirstOrDefault(x => x.ImproveType == Improvement.ImprovementType.AdeptPowerFreePoints && x.ImprovedName == PowerObject.Name && x.UniqueName == PowerObject.Extra)?.SourceName;
                Gear   objGear = PowerObject.CharacterObject.Gear.FirstOrDefault(x => x.Bonded && x.InternalId == strImprovementSourceName);
                if (objGear != null)
                {
                    objGear.Equipped = false;
                    objGear.Extra    = string.Empty;
                }
            }
            PowerObject.Deleting = true;
            ImprovementManager.RemoveImprovements(PowerObject.CharacterObject, Improvement.ImprovementSource.Power, PowerObject.InternalId);
            PowerObject.CharacterObject.Powers.Remove(PowerObject);

            if (_objPower.CharacterObject.Created)
            {
                frmCareer parent = frmParent as frmCareer;
                parent.ScheduleCharacterUpdate();
            }
            else
            {
                frmCreate parent = frmParent as frmCreate;
                parent.ScheduleCharacterUpdate();
            }
        }
Beispiel #2
0
 internal void CallPlugins(frmCareer frmCareer, CustomActivity parentActivity)
 {
     foreach (var plugin in MyActivePlugins)
     {
         using (var op_plugin = Timekeeper.StartSyncron("load_plugin_GetTabPage_Career_" + plugin.ToString(),
                                                        parentActivity, CustomActivity.OperationType.DependencyOperation, plugin.ToString()))
         {
             var pages = plugin.GetTabPages(frmCareer);
             if (pages == null)
             {
                 continue;
             }
             foreach (TabPage page in pages)
             {
                 if (page != null)
                 {
                     if (!frmCareer.TabCharacterTabs.TabPages.Contains(page))
                     {
                         frmCareer.TabCharacterTabs.TabPages.Add(page);
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
        private void cmdImproveATT_Click(object sender, EventArgs e)
        {
            frmCareer parent = ParentForm as frmCareer;

            if (parent != null)
            {
                int upgradeKarmaCost = attribute.UpgradeKarmaCost();

                if (upgradeKarmaCost == -1)
                {
                    return;                         //TODO: more descriptive
                }
                string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpense"),
                                                     attribute.DisplayNameFormatted, attribute.Value + 1, upgradeKarmaCost);
                if (upgradeKarmaCost > _objCharacter.Karma)
                {
                    MessageBox.Show(LanguageManager.GetString("Message_NotEnoughKarma"), LanguageManager.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (!parent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }
            attribute.Upgrade();
            ValueChanged?.Invoke(this, e);
        }
Beispiel #4
0
        private void btnCareerIncrease_Click(object sender, EventArgs e)
        {
            frmCareer parent = ParentForm as frmCareer;

            if (parent != null)
            {
                int upgradeKarmaCost = _skill.UpgradeKarmaCost();

                if (upgradeKarmaCost == -1)
                {
                    return;                                         //TODO: more descriptive
                }
                string confirmstring;
                if (_skill.Karma == 0)
                {
                    confirmstring = string.Format(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseKnowledgeSkill"),
                                                  _skill.DisplayName, _skill.Rating + 1, _skill.CharacterObject.Options.KarmaNewKnowledgeSkill, cboType.GetItemText(cboType.SelectedItem));
                }
                else
                {
                    confirmstring = string.Format(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense"),
                                                  _skill.DisplayName, _skill.Rating + 1, upgradeKarmaCost, cboType.GetItemText(cboType.SelectedItem));
                }

                if (!parent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }
            cboType.Enabled = false;

            _skill.Upgrade();
        }
Beispiel #5
0
        private void btnAddSpec_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                string confirmstring = string.Format(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"),
                                                     skill.CharacterObject.Options.KarmaSpecialization);

                if (!parrent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }

            frmSelectSpec selectForm = new frmSelectSpec(skill);

            selectForm.Mode = "Knowledge";
            selectForm.ShowDialog();

            if (selectForm.DialogResult != DialogResult.OK)
            {
                return;
            }

            skill.AddSpecialization(selectForm.SelectedItem);

            //TODO turn this into a databinding, but i don't care enough right now
            lblSpec.Text = string.Join(", ",
                                       (from specialization in skill.Specializations
                                        select specialization.Name));

            parrent?.UpdateCharacterInfo();
        }
        private void btnAddSpec_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                int price = _skill.CharacterObject.Options.KarmaKnowledgeSpecialization;

                int     intExtraSpecCost      = 0;
                int     intTotalBaseRating    = _skill.TotalBaseRating;
                decimal decSpecCostMultiplier = 1.0m;
                foreach (Improvement objLoopImprovement in _skill.CharacterObject.Improvements)
                {
                    if (objLoopImprovement.Minimum <= intTotalBaseRating &&
                        (string.IsNullOrEmpty(objLoopImprovement.Condition) || (objLoopImprovement.Condition == "career") == _skill.CharacterObject.Created || (objLoopImprovement.Condition == "create") != _skill.CharacterObject.Created) && objLoopImprovement.Enabled)
                    {
                        if (objLoopImprovement.ImprovedName == _skill.SkillCategory)
                        {
                            if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCost)
                            {
                                intExtraSpecCost += objLoopImprovement.Value;
                            }
                            else if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCostMultiplier)
                            {
                                decSpecCostMultiplier *= objLoopImprovement.Value / 100.0m;
                            }
                        }
                    }
                }
                if (decSpecCostMultiplier != 1.0m)
                {
                    price = decimal.ToInt32(decimal.Ceiling(price * decSpecCostMultiplier));
                }
                price += intExtraSpecCost; //Spec

                string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"), price.ToString());

                if (!parrent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }

            frmSelectSpec selectForm = new frmSelectSpec(_skill);

            selectForm.Mode = "Knowledge";
            selectForm.ShowDialog();

            if (selectForm.DialogResult != DialogResult.OK)
            {
                return;
            }

            _skill.AddSpecialization(selectForm.SelectedItem);

            //TODO turn this into a databinding, but i don't care enough right now
            lblSpec.Text = string.Join(", ", _skill.Specializations.Select(x => x.Name));

            parrent?.ScheduleCharacterUpdate();
        }
Beispiel #7
0
        private void btnAddSpec_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"),
                                                     _skill.CharacterObject.Options.KarmaSpecialization);

                if (!parrent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }

            frmSelectSpec selectForm = new frmSelectSpec(_skill);

            selectForm.ShowDialog();

            if (selectForm.DialogResult != DialogResult.OK)
            {
                return;
            }

            _skill.AddSpecialization(selectForm.SelectedItem);

            //TODO turn this into a databinding, but i don't care enough right now
            lblCareerSpec.Text = string.Join(", ", _skill.Specializations.Select(x => x.DisplayName));

            parrent?.ScheduleCharacterUpdate();
        }
Beispiel #8
0
        /// <summary>
        /// Load a Character and open the correct window.
        /// </summary>
        /// <param name="strFileName">File to load.</param>
        /// <param name="blnIncludeInMRU">Whether or not the file should appear in the MRU list.</param>
        /// <param name="strNewName">New name for the character.</param>
        /// <param name="blnClearFileName">Whether or not the name of the save file should be cleared.</param>
        public void LoadCharacter(string strFileName, bool blnIncludeInMRU = true, string strNewName = "", bool blnClearFileName = false)
        {
            if (File.Exists(strFileName) && strFileName.EndsWith("chum5"))
            {
                bool      blnLoaded    = false;
                Character objCharacter = new Character();
                objCharacter.FileName = strFileName;
                blnLoaded             = objCharacter.Load();

                if (!blnLoaded)
                {
                    return;
                }

                // If a new name is given, set the character's name to match (used in cloning).
                if (strNewName != "")
                {
                    objCharacter.Name = strNewName;
                }
                // Clear the File Name field so that this does not accidentally overwrite the original save file (used in cloning).
                if (blnClearFileName)
                {
                    objCharacter.FileName = "";
                }

                // Show the character form.
                if (!objCharacter.Created)
                {
                    frmCreate frmCharacter = new frmCreate(objCharacter);
                    frmCharacter.MdiParent   = this;
                    frmCharacter.WindowState = FormWindowState.Maximized;
                    frmCharacter.Loading     = true;
                    frmCharacter.Show();
                }
                else
                {
                    frmCareer frmCharacter = new frmCareer(objCharacter);
                    frmCharacter.MdiParent            = this;
                    frmCharacter.WindowState          = FormWindowState.Maximized;
                    frmCharacter.Loading              = true;
                    frmCharacter.DiceRollerOpened    += objCareer_DiceRollerOpened;
                    frmCharacter.DiceRollerOpenedInt += objCareer_DiceRollerOpenedInt;
                    frmCharacter.Show();
                }

                if (blnIncludeInMRU)
                {
                    GlobalOptions.Instance.AddToMRUList(strFileName);
                }

                objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
                objCharacter_CharacterNameChanged(objCharacter);
            }
            else
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_FileNotFound").Replace("{0}", strFileName), LanguageManager.Instance.GetString("MessageTitle_FileNotFound"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Open the correct windows for a list of characters (not thread-safe).
        /// </summary>
        /// <param name="lstCharacters">Characters for which windows should be opened.</param>
        public void OpenCharacterList(IEnumerable <Character> lstCharacters, bool blnIncludeInMRU = true)
        {
            if (lstCharacters == null)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;

            foreach (Character objCharacter in lstCharacters)
            {
                if (objCharacter == null)
                {
                    continue;
                }
                Timekeeper.Start("load_event_time");
                // Show the character form.
                if (!objCharacter.Created)
                {
                    frmCreate frmCharacter = new frmCreate(objCharacter)
                    {
                        MdiParent   = this,
                        WindowState = FormWindowState.Maximized,
                        Loading     = true
                    };
                    frmCharacter.Show();
                }
                else
                {
                    frmCareer frmCharacter = new frmCareer(objCharacter)
                    {
                        MdiParent   = this,
                        WindowState = FormWindowState.Maximized,
                        Loading     = true
                    };
                    frmCharacter.DiceRollerOpened    += objCareer_DiceRollerOpened;
                    frmCharacter.DiceRollerOpenedInt += objCareer_DiceRollerOpenedInt;
                    frmCharacter.Show();
                }

                if (blnIncludeInMRU)
                {
                    GlobalOptions.AddToMRUList(objCharacter.FileName);
                }

                objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
                objCharacter_CharacterNameChanged(objCharacter);
                Timekeeper.Finish("load_event_time");
            }

            Cursor = Cursors.Default;
        }
Beispiel #10
0
        IEnumerable <TabPage> IPlugin.GetTabPages(frmCareer input)
        {
            SINnersUserControl uc = new SINnersUserControl();
            var     ce            = uc.SetCharacterFrom(input);
            TabPage page          = new TabPage("SINners");

            page.Name = "SINners";
            page.Controls.Add(uc);
            return(new List <TabPage>()
            {
                page
            });
        }
Beispiel #11
0
        private void btnCareerIncrease_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpense"),
                                                     _skill.DisplayName, _skill.Rating + 1, _skill.UpgradeKarmaCost());

                if (!parrent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }

            _skill.Upgrade();
        }
Beispiel #12
0
        public void LoadCharacter()
        {
            Debug.WriteLine("Unit test initialized for: LoadCharacter()");
            string        strPath     = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "TestFiles");
            DirectoryInfo objPathInfo = new DirectoryInfo(strPath); //Assuming Test is your Folder

            FileInfo[] aobjFiles = objPathInfo.GetFiles("*.chum5"); //Getting Text files
            foreach (FileInfo objFileInfo in aobjFiles)
            {
                try
                {
                    Debug.WriteLine("Loading: " + objFileInfo.Name);
                    Character objLoopCharacter = MainForm.LoadCharacter(objFileInfo.FullName);
                    Assert.IsNotNull(objLoopCharacter);
                    Debug.WriteLine("Character loaded: " + objLoopCharacter.Name);
                    if (objLoopCharacter.Created)
                    {
                        frmCareer _ = new frmCareer(objLoopCharacter);
                        //SINnersUsercontrol sINnersUsercontrol = new SINnersUsercontrol(career);
                        //sINnersUsercontrol.UploadSINnerAsync();
                    }
                    else
                    {
                        frmCreate _ = new frmCreate(objLoopCharacter);
                    }
                    Debug.WriteLine("Test Form Created: " + objLoopCharacter.Name);
                }
                catch (AssertFailedException e)
                {
                    string strErrorMessage = "Could not load " + objFileInfo.FullName + "!";
                    strErrorMessage += Environment.NewLine + e.ToString();
                    Debug.WriteLine(strErrorMessage);
                    Console.WriteLine(strErrorMessage);
                }
                catch (Exception e)
                {
                    string strErrorMessage = "Exception while loading " + objFileInfo.FullName + ":";
                    strErrorMessage += Environment.NewLine + e.ToString();
                    Debug.WriteLine(strErrorMessage);
                    Console.WriteLine(strErrorMessage);
                    throw;
                }
            }
        }
Beispiel #13
0
        IEnumerable <TabPage> IPlugin.GetTabPages(frmCareer input)
        {
            ucSINnersUserControl uc = new ucSINnersUserControl();
            var ce = uc.SetCharacterFrom(input);

            if (ce.Status == TaskStatus.Faulted)
            {
                ChummerHub.Client.Backend.Utils.HandleError(ce.Exception);
                return(new List <TabPage>());
            }
            TabPage page = new TabPage("SINners");

            page.Name = "SINners";
            page.Controls.Add(uc);
            return(new List <TabPage>()
            {
                page
            });
        }
Beispiel #14
0
        public void LoadCharacter()
        {
            Debug.WriteLine("Unit test initialized for: LoadCharacter()");
            string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

            path = System.IO.Path.Combine(path, "TestFiles");
            DirectoryInfo d = new DirectoryInfo(path); //Assuming Test is your Folder

            FileInfo[] Files = d.GetFiles("*.chum5");  //Getting Text files
            foreach (FileInfo file in Files)
            {
                try
                {
                    Debug.WriteLine("Loading: " + file.Name);
                    Character c = MainForm.LoadCharacter(file.FullName);
                    Assert.IsNotNull(c);
                    Debug.WriteLine("Character loaded: " + c.Name);
                    if (c.Created)
                    {
                        frmCareer career = new frmCareer(c);
                        //SINnersUsercontrol sINnersUsercontrol = new SINnersUsercontrol(career);
                        //sINnersUsercontrol.UploadSINnerAsync();
                    }
                }
                catch (AssertFailedException e)
                {
                    string msg = "Could not load " + file.FullName + "!";
                    msg += Environment.NewLine + e.ToString();
                    Debug.WriteLine(msg);
                    Console.WriteLine(msg);
                }
                catch (Exception e)
                {
                    string msg = "Exception while loading " + file.FullName + ":";
                    msg += Environment.NewLine + e.ToString();
                    Debug.WriteLine(msg);
                    Console.WriteLine(msg);
                    throw;
                }
            }
        }
Beispiel #15
0
 internal void CallPlugins(frmCareer frmCareer)
 {
     foreach (var plugin in MyActivePlugins)
     {
         var pages = plugin.GetTabPages(frmCareer);
         if (pages == null)
         {
             continue;
         }
         foreach (TabPage page in pages)
         {
             if (page != null)
             {
                 if (!frmCareer.TabCharacterTabs.TabPages.Contains(page))
                 {
                     frmCareer.TabCharacterTabs.TabPages.Add(page);
                 }
             }
         }
     }
 }
Beispiel #16
0
        private void btnCareerIncrease_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                int upgradeKarmaCost = skill.UpgradeKarmaCost();

                if (upgradeKarmaCost == -1)
                {
                    return;                                         //TODO: more descriptive
                }
                string confirmstring = string.Format(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense"),
                                                     skill.DisplayName, skill.Rating + 1, upgradeKarmaCost);

                if (!parrent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }

            skill.Upgrade();
        }
Beispiel #17
0
        /// <summary>
        /// Load a Character and open the correct window.
        /// </summary>
        /// <param name="strFileName">File to load.</param>
        /// <param name="blnIncludeInMRU">Whether or not the file should appear in the MRU list.</param>
        /// <param name="strNewName">New name for the character.</param>
        /// <param name="blnClearFileName">Whether or not the name of the save file should be cleared.</param>
        public void LoadCharacter(string strFileName, bool blnIncludeInMRU = true, string strNewName = "", bool blnClearFileName = false)
        {
            if (File.Exists(strFileName) && strFileName.EndsWith("chum5"))
            {
                Timekeeper.Start("loading");
                Cursor.Current = Cursors.WaitCursor;
                bool      blnLoaded    = false;
                Character objCharacter = new Character();
                objCharacter.FileName = strFileName;

                XmlDocument objXmlDocument = new XmlDocument();
                //StreamReader is used to prevent encoding errors
                using (StreamReader sr = new StreamReader(strFileName, true))
                {
                    try
                    {
                        objXmlDocument.Load(sr);
                    }
                    catch (XmlException ex)
                    {
                        MessageBox.Show(LanguageManager.GetString("Message_FailedLoad").Replace("{0}", ex.Message), LanguageManager.GetString("MessageTitle_FailedLoad"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                XmlNode objXmlCharacter = objXmlDocument.SelectSingleNode("/character");
                if (!string.IsNullOrEmpty(objXmlCharacter?["appversion"]?.InnerText))
                {
                    Version verSavedVersion;
                    Version verCorrectedVersion;
                    string  strVersion = objXmlCharacter["appversion"].InnerText;
                    if (strVersion.StartsWith("0."))
                    {
                        strVersion = strVersion.Substring(2);
                    }
                    Version.TryParse(strVersion, out verSavedVersion);
                    Version.TryParse("5.188.34", out verCorrectedVersion);
                    if (verCorrectedVersion != null && verSavedVersion != null)
                    {
                        int intResult = verSavedVersion.CompareTo(verCorrectedVersion);
                        //Check for typo in Corrupter quality and correct it
                        if (intResult == -1)
                        {
                            File.WriteAllText(strFileName, Regex.Replace(File.ReadAllText(strFileName), "Corruptor", "Corrupter"));
                        }
                    }
                }

                Timekeeper.Start("load_file");
                blnLoaded = objCharacter.Load();
                Timekeeper.Finish("load_file");
                Timekeeper.Start("load_free");
                if (!blnLoaded)
                {
                    Cursor.Current = Cursors.Default;
                    return;
                }

                // If a new name is given, set the character's name to match (used in cloning).
                if (!string.IsNullOrEmpty(strNewName))
                {
                    objCharacter.Name = strNewName;
                }
                // Clear the File Name field so that this does not accidentally overwrite the original save file (used in cloning).
                if (blnClearFileName)
                {
                    objCharacter.FileName = string.Empty;
                }

                // Show the character form.
                if (!objCharacter.Created)
                {
                    frmCreate frmCharacter = new frmCreate(objCharacter)
                    {
                        MdiParent   = this,
                        WindowState = FormWindowState.Maximized,
                        Loading     = true
                    };
                    frmCharacter.Show();
                }
                else
                {
                    frmCareer frmCharacter = new frmCareer(objCharacter)
                    {
                        MdiParent   = this,
                        WindowState = FormWindowState.Maximized,
                        Loading     = true
                    };
                    frmCharacter.DiceRollerOpened    += objCareer_DiceRollerOpened;
                    frmCharacter.DiceRollerOpenedInt += objCareer_DiceRollerOpenedInt;
                    frmCharacter.Show();
                }

                if (blnIncludeInMRU)
                {
                    GlobalOptions.AddToMRUList(strFileName);
                }

                objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
                objCharacter_CharacterNameChanged(objCharacter);
                Cursor.Current = Cursors.Default;
            }
            else
            {
                MessageBox.Show(LanguageManager.GetString("Message_FileNotFound").Replace("{0}", strFileName), LanguageManager.GetString("MessageTitle_FileNotFound"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #18
0
        public async Task LoadCharacter()
        {
            Properties.Settings.Default.SINnerUrl = "https://sinners.azurewebsites.net/";
            Debug.WriteLine("Unit test initialized for: LoadCharacter()");
            string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

            if (MainForm == null)
            {
                MainForm = new frmChummerMain(true);
            }
            path = System.IO.Path.Combine(path, "data");
            DirectoryInfo d = new DirectoryInfo(path); //Assuming Test is your Folder

            FileInfo[] Files = d.GetFiles("*.chum5");  //Getting Text files
            foreach (FileInfo file in Files)
            {
                try
                {
                    Debug.WriteLine("Loading: " + file.Name);
                    Character c = await MainForm.LoadCharacter(file.FullName);

                    if (c == null)
                    {
                        continue;
                    }
                    Debug.WriteLine("Character loaded: " + c.Name);
                    if (c.Created)
                    {
                        using (frmCareer career = new frmCareer(c))
                        {
                            career.Show();
                            ucSINnersUserControl sINnersUsercontrol = new ucSINnersUserControl();
                            var ce = await sINnersUsercontrol.SetCharacterFrom(career);

                            await ChummerHub.Client.Backend.Utils.PostSINnerAsync(ce);

                            await ChummerHub.Client.Backend.Utils.UploadChummerFileAsync(ce);

                            career.Hide();
                            career.Dispose();
                        }
                    }
                    else
                    {
                        using (frmCreate create = new frmCreate(c))
                        {
                            create.Show();
                            ucSINnersUserControl sINnersUsercontrol = new ucSINnersUserControl();
                            var ce = await sINnersUsercontrol.SetCharacterFrom(create);

                            await ChummerHub.Client.Backend.Utils.PostSINnerAsync(ce);

                            await ChummerHub.Client.Backend.Utils.UploadChummerFileAsync(ce);

                            create.Hide();
                            create.Dispose();
                        }
                    }
                }
                catch (Exception e)
                {
                    string msg = "Exception while loading " + file.FullName + ":";
                    msg += Environment.NewLine + e.ToString();
                    Debug.Write(msg);
                    throw;
                }
            }
        }
 public IEnumerable <System.Windows.Forms.TabPage> GetTabPages(frmCareer input)
 {
     //here you can add (or remove!) tabs from frmCareer
     //as well as manipulate every single tab
     return(null);
 }
Beispiel #20
0
        private void mnuNewCritter_Click(object sender, EventArgs e)
        {
            Character objCharacter = new Character();
            string    settingsPath = Path.Combine(Application.StartupPath, "settings");

            string[] settingsFiles = Directory.GetFiles(settingsPath, "*.xml");

            if (settingsFiles.Length > 1)
            {
                Cursor = Cursors.WaitCursor;
                frmSelectSetting frmPickSetting = new frmSelectSetting();
                frmPickSetting.ShowDialog(this);
                Cursor = Cursors.Default;

                if (frmPickSetting.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                objCharacter.SettingsFile = frmPickSetting.SettingsFile;
            }
            else
            {
                string strSettingsFile = settingsFiles[0];
                objCharacter.SettingsFile = Path.GetFileName(strSettingsFile);
            }

            Cursor = Cursors.WaitCursor;

            // Override the defaults for the setting.
            objCharacter.IgnoreRules = true;
            objCharacter.IsCritter   = true;
            objCharacter.Created     = true;
            objCharacter.BuildMethod = CharacterBuildMethod.Karma;
            objCharacter.BuildPoints = 0;

            // Show the Metatype selection window.
            frmKarmaMetatype frmSelectMetatype = new frmKarmaMetatype(objCharacter)
            {
                XmlFile = "critters.xml"
            };

            frmSelectMetatype.ShowDialog();
            Cursor = Cursors.Default;

            if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            Cursor = Cursors.WaitCursor;

            // Add the Unarmed Attack Weapon to the character.
            XmlDocument objXmlDocument = XmlManager.Load("weapons.xml");
            XmlNode     objXmlWeapon   = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"Unarmed Attack\"]");

            if (objXmlWeapon != null)
            {
                Weapon objWeapon = new Weapon(objCharacter);
                objWeapon.Create(objXmlWeapon, null, null, null, objCharacter.Weapons);
                objCharacter.Weapons.Add(objWeapon);
            }

            frmCareer frmNewCharacter = new frmCareer(objCharacter)
            {
                MdiParent   = this,
                WindowState = FormWindowState.Maximized
            };

            frmNewCharacter.Show();

            objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
            Cursor = Cursors.Default;
        }