Esempio n. 1
0
        private void createResourceCtrl_OnCreateResource(string assemblyFileName, string resourceFileName)
        {
            if (File.Exists(resourceFileName))
            {
                if (MessageBox.Show("File " + resourceFileName + " already exists. Override?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }
            }
            ResourceManager.CreateResourceFile(assemblyFileName, resourceFileName);

            if (openFiles.ContainsKey(resourceFileName))
            {
                int index = resTabCtrl.TabPages.IndexOf(openFiles[resourceFileName]);
                resTabCtrl.TabPages.Remove(openFiles[resourceFileName]);
                ResourceTab tab = new ResourceTab(resourceFileName, ResourceManager.LoadResourceFile(resourceFileName));
                resTabCtrl.TabPages.Insert(index, tab);
                resTabCtrl.SelectedTab      = tab;
                openFiles[resourceFileName] = tab;
            }
            else
            {
                ResourceTab tab = new ResourceTab(resourceFileName, ResourceManager.LoadResourceFile(resourceFileName));
                resTabCtrl.TabPages.Add(tab);
                resTabCtrl.SelectedTab = tab;
                openFiles.Add(resourceFileName, tab);
            }
            ShowFileInfo();
            ControlStatus();
        }
Esempio n. 2
0
 private void CloseTab(ResourceTab tab)
 {
     if (tab != null)
     {
         if (tab.DataSource.GetChanges() != null)
         {
             if (MessageBox.Show("Save " + tab.Text + " ?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 ResourceManager.SaveResourceFile(
                     tab.FileName,
                     tab.DataSource);
             }
         }
         resTabCtrl.TabPages.Remove(tab);
     }
 }
Esempio n. 3
0
 private void LoadResource(string resourceFileName)
 {
     if (openFiles.ContainsKey(resourceFileName))
     {
         int index = resTabCtrl.TabPages.IndexOf(openFiles[resourceFileName]);
         resTabCtrl.TabPages.Remove(openFiles[resourceFileName]);
         ResourceTab tab = new ResourceTab(resourceFileName, ResourceManager.LoadResourceFile(resourceFileName));
         resTabCtrl.TabPages.Insert(index, tab);
         resTabCtrl.SelectedTab      = tab;
         openFiles[resourceFileName] = tab;
     }
     else
     {
         ResourceTab tab = new ResourceTab(resourceFileName, ResourceManager.LoadResourceFile(resourceFileName));
         resTabCtrl.TabPages.Add(tab);
         resTabCtrl.SelectedTab = tab;
         openFiles.Add(resourceFileName, tab);
     }
     ShowFileInfo();
     ControlStatus();
 }