Пример #1
0
 public static DialogResult ShowInfo(string msg, string caption)
 {
     PluginDebug.AddInfo("Show info", 6, caption, msg);
     return(MessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Information));
 }
Пример #2
0
        private static void AddPluginToOverview(string sPluginName, TabControl tcPlugins)
        {
            if (tcPlugins == null)
            {
                tcPlugins = AddPluginTabContainer();
            }
            TabPage  tpOverview    = null;
            ListView lv            = null;
            string   sTabName      = c_tabRookiestyle + "_PluginOverview";
            string   sListViewName = c_tabRookiestyle + "_PluginOverviewListView";

            if (tcPlugins.TabPages.ContainsKey(sTabName))
            {
                tpOverview = tcPlugins.TabPages[sTabName];
                lv         = (ListView)tpOverview.Controls.Find(sListViewName, true)[0];
                PluginDebug.AddInfo("Found " + sTabName, 0, "Listview: " + (lv == null ? "null" : lv.Items.Count.ToString() + " /" + lv.Name.ToString()));
            }
            else
            {
                tpOverview = new TabPage("Overview");
                tpOverview.CreateControl();
                tpOverview.Name = sTabName;
                UserControl uc = new UserControl();
                uc.Dock    = DockStyle.Fill;
                uc.Padding = new Padding(15, 10, 15, 10);
                tpOverview.Controls.Add(uc);
                lv      = new ListView();
                lv.Name = sListViewName;
                lv.Dock = DockStyle.Fill;
                lv.View = View.Details;
                lv.Columns.Add("Plugin");
                lv.Columns.Add("Version");
                lv.CheckBoxes      = true;
                tpOverview.Layout += TpOverview_Layout;
                Label lInfo = new Label();
                lInfo.Text = "Use the checkbox to activate/deactivate debug mode";
                lInfo.Dock = DockStyle.Bottom;
                uc.Controls.Add(lv);
                uc.Controls.Add(lInfo);
            }
            lv.ItemCheck    += Lv_ItemCheck;
            lv.Sorting       = SortOrder.Ascending;
            lv.FullRowSelect = true;
            ListViewItem lvi = new ListViewItem();

            lvi.Name    = sPluginName;
            lvi.Checked = PluginDebug.DebugMode;
            lvi.Text    = DefaultCaption;
            Version v = new Version(0, 0);

            GetLoadedPluginsName().TryGetValue(sPluginName.Replace("Ext", string.Empty) + "." + sPluginName, out v);
            if (v == null)
            {
                PluginDebug.AddError("Could not get loaded plugins' data", 0);
            }
            string ver = (v == null) ? "???" : v.ToString();

            if (ver.EndsWith(".0"))
            {
                ver = ver.Substring(0, ver.Length - 2);
            }
            else
            {
                ver += " (Dev)";
            }
            lvi.SubItems.Add(ver);
            lv.Items.Add(lvi);
            tcPlugins.TabPages.Remove(tpOverview);
            tcPlugins.TabPages.Add(tpOverview);
            PluginDebug.AddInfo("Added " + sTabName, 0, "Listview: " + (lv == null ? "null" : lv.Items.Count.ToString() + " /" + lv.Name.ToString()));
        }
Пример #3
0
 public static DialogResult ShowError(string msg, string caption)
 {
     PluginDebug.AddError("Show error", 6, caption, msg);
     return(MessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Error));
 }