Exemplo n.º 1
0
        private void UpdateModInfo(ModEntry m)
        {
            if (m == null)
            {
                // hide panel
                //horizontal_splitcontainer.Panel2Collapsed = true;
                return;
            }

            // show panel
            horizontal_splitcontainer.Panel2Collapsed = false;

            // Update data
            modinfo_info_TitleTextBox.Text           = m.Name;
            modinfo_info_AuthorTextBox.Text          = m.Author;
            modinfo_info_DateCreatedTextBox.Text     = m.DateCreated?.ToString() ?? "";
            modinfo_info_InstalledTextBox.Text       = m.DateAdded?.ToString() ?? "";
            modinfo_info_DescriptionRichTextBox.Font = DefaultFont;
            modinfo_info_DescriptionRichTextBox.Clear();
            modinfo_info_DescriptionRichTextBox.Rtf = m.GetDescription(true);
            btnDescSave.Enabled                    = false;
            modinfo_readme_RichTextBox.Text        = m.GetReadMe();
            modinfo_image_picturebox.ImageLocation = m.Image;

            var sel_obj = m.GetProperty();

            sel_obj.PropertyChanged += (sender, e) => { RefreshModList(); modinfo_inspect_propertygrid.Refresh(); };
            modinfo_inspect_propertygrid.SelectedObject = sel_obj;

            #region Config

            // config files
            string[] configFiles = m.GetConfigFiles();

            // clear
            modinfo_config_FileSelectCueComboBox.Items.Clear();
            modinfo_ConfigFCTB.Text             = "";
            modinfo_config_LoadButton.Enabled   = false;
            modinfo_config_RemoveButton.Enabled = false;

            if (configFiles.Length > 0)
            {
                foreach (var configFile in configFiles)
                {
                    if (configFile != null)
                    {
                        modinfo_config_FileSelectCueComboBox.Items.Add(CurrentMod.GetPathRelative(configFile));
                    }
                }
            }

            #endregion
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update mod information panel with data from specified mod.
        /// </summary>
        /// <param name="m"></param>
        private void UpdateModInfo(ModEntry m)
        {
            if (m == null)
            {
                modinfo_info_TitleTextBox.Text = "No mod or multiple mods selected";
                modinfo_info_AuthorTextBox.Clear();
                modinfo_info_DateCreatedTextBox.Clear();
                modinfo_info_InstalledTextBox.Clear();
                modinfo_readme_RichTextBox.Clear();
                modinfo_changelog_richtextbox.Clear();
                UpdateModDescription(null);
                modinfo_image_picturebox.ImageLocation      = null;
                modinfo_inspect_propertygrid.SelectedObject = null;
                modinfo_config_FileSelectCueComboBox.Items.Clear();
                modinfo_config_LoadButton.Enabled   = false;
                modinfo_config_RemoveButton.Enabled = false;
                modinfo_ConfigFCTB.Clear();
                modinfo_ConfigFCTB.ReadOnly = true;
                olvRequiredMods.ClearObjects();
                olvDependentMods.ClearObjects();
                return;
            }

            // show panel
            horizontal_splitcontainer.Panel2Collapsed = false;

            // Update data
            modinfo_info_TitleTextBox.Text       = m.Name;
            modinfo_info_AuthorTextBox.Text      = m.Author;
            modinfo_info_DateCreatedTextBox.Text = m.DateCreated?.ToString() ?? "";
            modinfo_info_InstalledTextBox.Text   = m.DateAdded?.ToString() ?? "";
            UpdateModDescription(m);
            UpdateModChangeLog(m);
            modinfo_readme_RichTextBox.Text        = m.GetReadMe();
            modinfo_image_picturebox.ImageLocation = m.Image;
            UpdateDependencyInformation(m);

            // Init handler for property changes
            var sel_obj = m.GetProperty();

            sel_obj.PropertyChanged += (sender, e) =>
            {
                RefreshModList();
                modinfo_inspect_propertygrid.Refresh();
            };

            modinfo_inspect_propertygrid.SelectedObject = sel_obj;

            #region Config

            // config files
            string[] configFiles = m.GetConfigFiles();

            // clear
            modinfo_config_FileSelectCueComboBox.Items.Clear();
            modinfo_ConfigFCTB.Text             = "";
            modinfo_config_LoadButton.Enabled   = false;
            modinfo_config_RemoveButton.Enabled = false;

            if (configFiles.Length > 0)
            {
                foreach (var configFile in configFiles)
                {
                    if (configFile != null)
                    {
                        modinfo_config_FileSelectCueComboBox.Items.Add(CurrentMod.GetPathRelative(configFile));
                    }
                }
            }

            #endregion
        }