示例#1
0
        private void mnuFileNewProject_Click(object sender, EventArgs e)
        {
            frmNewProject newProjectForm = new frmNewProject();

            if (newProjectForm.ShowDialog() == DialogResult.OK)
            {
                currentProject = newProjectForm.NewProject;
            }
        }
示例#2
0
 private void OpenProject(AMProject currentProject)
 {
     MBBannerlordModManager.Instance.Init();
     btnKingdoms.Enabled      = true;
     btnNPCCharacters.Enabled = true;
     btnCultures.Enabled      = true;
     btnHeros.Enabled         = true;
     btnItems.Enabled         = true;
 }
示例#3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(txtModuleLocation.Text))
            {
                MessageBox.Show("Please select a valid path");
            }
            project      = new AMProject(txtModuleLocation.Text);
            DialogResult = DialogResult.OK;

            Close();
        }
示例#4
0
        public frmMain(AppSetting appSetting, RecentOperations recentOperations)
        {
            InitializeComponent();
            this.appSetting = appSetting;

            LanguageManager.Instance.CurrentLocalization = appSetting.Localization;

            SwitchLanguage();

            foreach (var langName in LanguageManager.Instance.GetLanguageNames())
            {
                var item = mnuToolLanguage.DropDownItems.Add(langName);
                item.Click += (o, e) =>
                {
                    LanguageManager.Instance.CurrentLocalization = langName;
                    appSetting.Localization = langName;
                    appSetting.Save();
                    SwitchLanguage();
                    foreach (var control in panelMain.Controls)
                    {
                        if (control is ILocalization)
                        {
                            (control as ILocalization).SwitchLanguage();
                        }
                    }
                };
            }

            this.recentOperations = recentOperations;
            foreach (var recentOpt in recentOperations.RecentOperationList)
            {
                if (recentOpt.Type == "Import")
                {
                    var item = mnuRecentlyImportedProject.DropDownItems.Add(recentOpt.Value);
                    item.Click += (o, e) =>
                    {
                        if (!Directory.Exists(recentOpt.Value))
                        {
                            MessageBox.Show(Helper.LOC("str_error_message_cannot_find_specific_directory"), Helper.LOC("str_error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        currentProject = new AMProject(recentOpt.Value);
                        OpenProject(currentProject);
                    };
                }
            }
        }
示例#5
0
        private void importModuleProject()
        {
            frmImportProject importProjectForm = new frmImportProject();

            if (importProjectForm.ShowDialog() == DialogResult.OK)
            {
                currentProject = importProjectForm.Project;
                OpenProject(currentProject);

                string loc = currentProject.Location.Replace("\\", "/");
                if (recentOperations.RecentOperationList.Where(o => o.Value == loc).Count() == 0)
                {
                    recentOperations.RecentOperationList.Add(new RecentOperation()
                    {
                        Type  = "Import",
                        Value = currentProject.Location.Replace("\\", "/")
                    });
                    XmlObjectLoader xmlObjectLoader = new XmlObjectLoader("RecentOperations.xml");
                    xmlObjectLoader.Save(recentOperations);
                }
            }
        }
 public frmNewProject()
 {
     InitializeComponent();
     SwitchLanguage();
     newProject = new AMProject();
 }