Ejemplo n.º 1
0
        /// <summary>
        /// Called when the user wishes to create the map.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_CreateMap(object sender, RoutedEventArgs e)
        {
            // Save the selected template
            string template = ctrlTemplates.SelectedItem as string;

            if (!string.IsNullOrEmpty(template))
            {
                UserData.SelectedMapTemplate = template;
            }

            // Save the data
            UserData.Instance.Save();

            // Get the map name
            string mapName = ctrlMapName.Text;

            if (!Utility.IsValid(mapName))
            {
                AppDialogMessage.Show(string.Format("The given map name of '{0}' is not valid.", mapName),
                                      "Invalid map name", MessageButtons.OK, MessageIcon.Warning);
            }
            else
            {
                SelectedMap = mapName;
                ComTemplate.Install(TemplateType.Maps, template, mapName);
                DialogResult = true;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when the window has completed initialization.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            List <string> templates = new List <string>();

            ComTemplate.GetTemplates(ref templates, TemplateType.Maps);

            ctrlTemplates.Items.Clear();
            foreach (string template in templates)
            {
                ctrlTemplates.Items.Add(template);
            }

            Utility.SelectValue(ref ctrlTemplates, UserData.SelectedMapTemplate);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when the user wishes to create the mod.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_CreateMod(object sender, RoutedEventArgs e)
        {
            // Save the selected template
            string template = ctrlTemplates.SelectedItem as string;

            if (!string.IsNullOrEmpty(template))
            {
                UserData.SelectedModTemplate = template;
            }

            // Save the selected type
            ComboBoxItem item = ctrlTypes.SelectedItem as ComboBoxItem;

            Debug.Assert(item != null);
            string type = item.Content as string;

            Debug.Assert(type != null);
            UserData.SelectedModType = type;

            // Save the data
            UserData.Instance.Save();

            // Get the mod name
            string modName = ctrlModName.Text;

            if (!Utility.IsValid(modName))
            {
                AppDialogMessage.Show(string.Format("The given mod name of '{0}' is not valid.", modName),
                                      "Invalid mod name", MessageButtons.OK, MessageIcon.Warning);
            }
            else
            {
                SelectedMod = modName;
                ComTemplate.Install(TemplateType.Mods, template, modName);
                SaveModType(modName, type);
                DialogResult = true;
            }
        }