Example #1
0
        private void SetupNewTab(FileTool plugin, string tabName)
        {
            if (plugin == null)
                return;
            var tabpTmp = new TabPage(tabName);
            tabpTmp.Controls.Add(plugin);
            plugin.Dock = DockStyle.Fill;
            m_tbcApps.TabPages.Add(tabpTmp);

            // register events
            plugin.KeyDown += TbcAppsKeyDown;
            plugin.OnHasChangesChanged += PluginOnHasChangesChanged;

            // set the active tab to the newly loaded file
            m_tbcApps.SelectedTab = tabpTmp;
        }
Example #2
0
 static public bool CloseTool(FileTool tool)
 {
     if (tool.File == null)
     {
         LoggingManager.SendMessage(LogSystemMessageType.Error, "FileManager - The File-Property of the plugin you're trying to close returned NULL! Plugin: {0}", tool.GetType().FullName);
         UIHelper.ShowError("The File-Property of the plugin you're trying to clsoe returned NULL! Contact the creator of the plugin.");
         ModManager.RequestAppExit("FileManager - Error in plugin");
         return false;
     }
     string path = tool.File.FilePath;
     if (tool.HasChanges)
     {
         DialogResult dr = UIHelper.ShowYNQuestion("Warning", "The current file has not been saved since the last changes have been made! Save it now?");
         if (dr == DialogResult.Yes)
         {
             tool.SaveFile();
         }
     }
     if (!tool.Close())
     {
         UIHelper.ShowWarning("The PlugIn could not be closed!");
         return false;
     }
     s_openTools.Remove(path);
     return true;
 }
Example #3
0
 private void FileManagerFileLoaded(UniFile file, FileTool plugin)
 {
     SetupNewTab(plugin, file.FileName);
 }