Ejemplo n.º 1
0
 /// <summary>
 /// 设置工具栏项
 /// </summary>
 protected void SetToolItems()
 {
     try
     {
         List <IToolsItem> items = Lemon.GetToolsItem();
         if (items != null)
         {
             foreach (IToolsItem item in items)
             {
                 if (Lemon.GetObjType(item.HostObject) == typeof(ToolStripButton))
                 {
                     Control mf = (Control)Lemon.GetMainForm();
                     mf.Invoke(new SetValue(SetToolStripButtonValue), item.HostObject, item.UIElement);
                 }
                 else if (Lemon.GetObjType(item.HostObject) == typeof(ToolStripComboBox))
                 {
                     Control mf = (Control)Lemon.GetMainForm();
                     mf.Invoke(new SetValue(SetToolStripComboBoxValue), item.HostObject, item.UIElement);
                 }
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 实现接口方法,框架默认的运行模块后自动调用初始化方法
 /// </summary>
 public void Initialize()
 {
     //有个缺陷,提示框会被等待窗体挡住,涉及线程运行有空在处理,
     //目前的处理方法有两种只要在Initialize后显示提示框即可,还可以主动直接调用框架封装的关闭等待窗体函数
     Lemon.GetMainForm().WatingProgram.CloseDialog();
     MessageBox.Show("HelloHelloHelloHelloHelloHello,这是一个由插件弹出的提示框,插件可以是窗体也可以是一个类似这样运行的后台功能");
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 登记模块,创建新的模块实例
 /// </summary>
 /// <param name="Info"></param>
 /// <param name="Parameters"></param>
 /// <returns></returns>
 public IModule CheckinModule(ModuleInfo Info, params object[] Parameters)
 {
     if (Info != null)
     {
         IModule result = Lemon.GetInstance <IModule>(Info.AssemblyPath, Info.FullClassName, Parameters);
         if (result != null)
         {
             result.ModuleName = Info.FullClassName;
             result.MainForm   = Lemon.GetMainForm();
             result.Initialize();
             Lemon.SendMsgDebug("运行插件:" + Info.FullClassName);
             this.moduleList.Add(result);
             return(result);
         }
         else
         {
             Lemon.SendMsgError("运行插件失败:" + Info.FullClassName);
             return(null);
         }
     }
     else
     {
         Lemon.SendMsgError("没找到插件信息,无法提示插件详细信息");
         return(null);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 设置布局
 /// </summary>
 /// <param name="LayoutName"></param>
 public virtual void SetLayout(string LayoutName)
 {
     if (this.layouts.Count > 0)
     {
         if (LayoutName != this.currentLayoutName)
         {
             //先取消布局
             this.CancelLayout();
             this.GetLayout(LayoutName).CreateLayout(Lemon.GetMainForm());
             this.currentLayoutName = LayoutName;
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置窗体
 /// </summary>
 /// <param name="TargetForm"></param>
 /// <param name="Manager"></param>
 public virtual bool SetWindows(System.Windows.Forms.Form TargetForm, ILayoutManager Manager)
 {
     try
     {
         Form mf = (Form)Lemon.GetMainForm();
         if (TargetForm != mf)
         {
             mf.Invoke(new SetWindowStyle(WinStyle), TargetForm, mf, Manager);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         Lemon.SendMsgError(ex);
         return(false);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 设置布局
 /// </summary>
 /// <param name="LayoutName"></param>
 public virtual void SetLayout(string LayoutName)
 {
     if (this.layouts.Count > 0)
     {
         if (LayoutName != this.currentLayoutName)
         {
             //先取消布局
             this.CancelLayout();
             ILayout culayout = this.GetLayout(LayoutName);
             if (culayout != null)
             {
                 culayout.CreateLayout(Lemon.GetMainForm());
                 this.currentLayoutName = LayoutName;
             }
             else
             {
                 Lemon.SendMsgWarning("没有找到名称为:" + LayoutName + " 的布局");
             }
         }
     }
 }