Esempio n. 1
0
        public static void AddResourceFile(string filePath)
        {
            string resID        = Path.GetFileName(filePath);
            int    resListIndex = resourceList.IndexOf(resID);

            if (resListIndex != -1)
            {
                if (Funcs.Question("A resource file with the same name is already in the resource list!\n" +
                                   $"Do you want to overwrite '{resID}' ?") != DialogResult.Yes)
                {
                    return;
                }
            }

            string destFile = string.Format("{0}{1}", projectTempDir, Path.GetFileName(filePath));

            File.Copy(filePath, destFile, true);

            if (resListIndex == -1)
            {
                // Add a new resource file
                resourceList.Add(resID);
                LoadResourceBitmap(destFile);
            }
            else
            {
                // Update the resource file in case of overwrite
                LoadResourceBitmap(destFile, resListIndex);
            }
        }
Esempio n. 2
0
        private void Btn_remove_lang_Click(object sender, EventArgs e)
        {
            if (languagesTable.SelectedCells.Count > 0)
            {
                int langID = Funcs.ToInt(languagesTable[grid_id.Index, languagesTable.SelectedCells[0].RowIndex].Value);

                if (langID == 0)
                {
                    Funcs.Information("You can't delete the default entry, it is the default text value used when no languages are avaible.");
                    return;
                }

                if (Funcs.Question("Are you sure you want to delete this language code ?\nNote that all label objects will lose this language code text value !  ") == DialogResult.Yes)
                {
                    Objects.RemoveLanguage(Languages.UsedLanguages[langID]);
                    Languages.UsedLanguages.Remove(Languages.UsedLanguages[langID]);
                    LoadLanguages();
                }
            }
        }
Esempio n. 3
0
        private void Btn_delete_Click(object sender, EventArgs e)
        {
            if (fontsTable.SelectedCells.Count > 0)
            {
                string fontID = fontsTable[grid_id.Index, fontsTable.SelectedCells[0].RowIndex].Value.ToString();

                if (fontID == Config.DEFAULT_FONT)
                {
                    Funcs.Information("You can't delete the default font, it is used when a font is missing or corrupted.");
                }
                else
                {
                    if (Funcs.Question("Are you sure you want to delete this font ?") == DialogResult.Yes)
                    {
                        Fonts.fontList.Remove(fontID);
                        Objects.DeletedFont(fontID);

                        LoadFonts();
                        Objects.RenderAll();
                    }
                }
            }
        }
Esempio n. 4
0
        private void Btn_deleteResource_Click(object sender, EventArgs e)
        {
            if (resourceList.SelectedItem == null)
            {
                return;
            }

            string resID = resourceList.SelectedItem.ToString();

            if (resourceList.SelectedIndex != 0)
            {
                if (Funcs.Question("Are you sure you want to delete this file ?") == DialogResult.Yes)
                {
                    // free the image file from the preview panel so it can be deleted
                    imageFrame.BackgroundImage = null;

                    Resources.RemoveResourceFile(resID);
                    RepopulateResourceList();

                    Objects.DeletedResource(resID);
                }
            }
        }