/// <summary> /// 加载所有的插件,如果已经注入则不再注入,注入同时生成HashTable插件缓存 /// </summary> public static void LoadAllPluginToMainForm(BaseMainForm form) { //LoadAllPlugin(); ///TODO:需要从配置文件中加载,免得顺序不对 LoadAllPluginCaches(); if (!HavedEmmitPlugin) { PluginsFileConfig config = FT.Commons.Cache.StaticCacheManager.GetConfig <PluginsFileConfig>(); if (config.PluginTypes.Count > 0)//如果配置里面插件数量大于0 { string tmp = ""; for (int i = 0; i < config.PluginTypes.Count; i++) { tmp = config.PluginTypes[i].ToString(); EmmitFromType(form, System.Type.GetType(tmp)); } } else { System.Collections.IDictionaryEnumerator enumerator = AllCaches.GetEnumerator(); //ListViewItem tmp = null; string att = string.Empty; while (enumerator.MoveNext()) { att = enumerator.Key.ToString(); if (att != null) { EmmitFromType(form, System.Type.GetType(att)); } } } HavedEmmitPlugin = true; } }
public static void BirthdayHint(object sender, EventArgs e) { BaseMainForm form = sender as BaseMainForm; CarStartSetting setting = FT.Commons.Cache.StaticCacheManager.GetConfig <CarStartSetting>(); if (setting.BirthDayHint) { DateTime before = System.DateTime.Now; DateTime end = System.DateTime.Now.AddDays(setting.Days); //c_birthday IDataAccess access = DataAccessFactory.GetDataAccess(); string condition = access.BetweenDateString( "c_birthday", before, end); DataTable dt = access.SelectDataTable("select * from table_cards where " + condition, "tmp"); if (dt != null && dt.Rows.Count > 0) { if (MessageBoxHelper.Confirm("有" + dt.Rows.Count + "人将在最近" + setting.Days + "天内过生日,是否查看?")) { form.GetSimpleTabControl().TabPages.Add("将过生日人员 "); //TabPage tb = new TabPage(); //this.form.GetSimpleTabControl().TabPages.Add(tb); TabPage tb = form.GetSimpleTabControl().TabPages[form.GetSimpleTabControl().TabPages.Count - 1]; //object paneltmp = ReflectHelper.CreateInstance(typeof(FT.Lottery.LotteryParse)); PersonCardSearch panel = new PersonCardSearch(); panel.SetConditions(condition); panel.Dock = DockStyle.Fill; tb.Controls.Add(panel); form.GetSimpleTabControl().SelectedIndex = form.GetSimpleTabControl().TabCount - 1; } } } }
public static void SaveProjectFile(BaseMainForm frmMain, MapWinControl.MapWinControl mapWinControl, string projectFile) { //frmMain.ContainerToolstrip // welke menu's zijn actief???? //// Todo setting zoals version uit een settingfile oid halen //MapWinProject mapwinProject = new MapWinProject(); //mapwinProject.Name = frmMain.Text.Replace("'", ""); //mapwinProject.Type = "projectfile.2"; //mapwinProject.Version = "4.8.5"; //// Get the mapstate from the ocx //string state = mapWinControl.LoadMapState(true, Path.GetDirectoryName(projectFile)); //mapwinProject.MapwinGis = state.DeserializeXml<MapWinProject.MapWinGIS>(); //// Fill the mapwindos projectSettings //string mapwindow = FillMapwindowSettings(); //mapwinProject.MapWindow = mapwindow.DeserializeXml<MapWinProject.MapWindow4>(); //// Serialize the settings //string prjSetting = mapwinProject.SerializeXml<MapWinProject>(); //// TODO nog even opslaan als een nieuw bestand. //using (StreamWriter outfile = new StreamWriter(projectFile)) //{ // // Save settings to file // outfile.Write(prjSetting); //} }
public virtual void StartUp(Aggregate aggregator) { Aggregator = aggregator; MainForm = aggregator.MainForm; CreateMenu(); CreateToolbar(); }
private void button5_Click(object sender, EventArgs e) { FT.Windows.Forms.BaseMainForm form = new BaseMainForm(); string path = FT.Commons.Tools.ReflectHelper.GetStartUpPath("plugins1\\FT.Lottery.dll"); Console.WriteLine("the path is->" + path); form.GetStatusStrip().Visible = false; //form.LoadPluginDebug(path); form.Show(); }
public void Emmit(BaseMainForm form) { if (this.form == null) { this.form = form; } this.EmmitMenu(); this.EmmitSeparator(); this.EmmitToolBar(); //throw new Exception("The method or operation is not implemented."); }
private void button12_Click(object sender, EventArgs e) { Form form = new FT.Windows.Forms.LoginForm(); if (form.ShowDialog() == DialogResult.OK) { FT.Windows.Forms.BaseMainForm form1 = new BaseMainForm(); form1.GetStatusStrip().Visible = false; //form.LoadPluginDebug(path); form1.Show(); } }
/// <summary> /// 把一个插件类型注入到主窗体中 /// </summary> /// <param name="form"></param> /// <param name="type"></param> private static void EmmitFromType(BaseMainForm form, Type type) { if (typeof(IPlugin).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract) { //InitPlugin(type); IPlugin obj = FT.Commons.Tools.ReflectHelper.CreateInstance(type) as IPlugin; if (obj != null) { AddUseCache(type); obj.Emmit(form); } } }
/// <summary> /// 把一个插件注入进去并生产插件的hashtable /// </summary> /// <param name="form"></param> /// <param name="file"></param> private static void EmmitFromFile(BaseMainForm form, FileInfo file) { if (!file.FullName.EndsWith(".dll")) { return; } if (file.Exists && form != null) { //AppDomain.CurrentDomain.Load( //Assembly ass = Assembly.LoadFile(file.FullName); Assembly ass = Assembly.LoadFrom(file.FullName); Type[] types = ass.GetTypes(); foreach (Type type in types) { EmmitFromType(form, type); } } }
/// <summary> /// �������еIJ��,����Ѿ�ע������ע�룬ע��ͬʱ����HashTable������� /// </summary> public static void LoadAllPluginToMainForm(BaseMainForm form) { //LoadAllPlugin(); ///TODO:��Ҫ�������ļ��м��أ����˳�� LoadAllPluginCaches(); if (!HavedEmmitPlugin) { PluginsFileConfig config=FT.Commons.Cache.StaticCacheManager.GetConfig<PluginsFileConfig>(); if (config.PluginTypes.Count > 0)//���������������������0 { string tmp = ""; for (int i = 0; i < config.PluginTypes.Count;i++ ) { tmp = config.PluginTypes[i].ToString(); EmmitFromType(form, System.Type.GetType(tmp)); } } else { System.Collections.IDictionaryEnumerator enumerator = AllCaches.GetEnumerator(); //ListViewItem tmp = null; string att = string.Empty; while (enumerator.MoveNext()) { att = enumerator.Key.ToString(); if (att != null) { EmmitFromType(form, System.Type.GetType(att)); } } } HavedEmmitPlugin = true; } }
/// <summary> /// 把一个插件注入进去并生产插件的hashtable /// </summary> /// <param name="form"></param> /// <param name="file"></param> private static void EmmitFromFile(BaseMainForm form, string file) { EmmitFromFile(form, new FileInfo(file)); }
/// <summary> /// ��һ���������ע�뵽�������� /// </summary> /// <param name="form"></param> /// <param name="type"></param> private static void EmmitFromType(BaseMainForm form, Type type) { if (typeof(IPlugin).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract) { //InitPlugin(type); IPlugin obj = FT.Commons.Tools.ReflectHelper.CreateInstance(type) as IPlugin; if (obj != null) { AddUseCache(type); obj.Emmit(form); } } }
/// <summary> /// ��һ�����ע���ȥ�����������hashtable /// </summary> /// <param name="form"></param> /// <param name="file"></param> private static void EmmitFromFile(BaseMainForm form, FileInfo file) { if (!file.FullName.EndsWith(".dll")) { return; } if (file.Exists && form != null) { //AppDomain.CurrentDomain.Load( //Assembly ass = Assembly.LoadFile(file.FullName); Assembly ass = Assembly.LoadFrom(file.FullName); Type[] types = ass.GetTypes(); foreach (Type type in types) { EmmitFromType(form, type); } } }
/// <summary> /// ��һ�����ע���ȥ�����������hashtable /// </summary> /// <param name="form"></param> /// <param name="file"></param> private static void EmmitFromFile(BaseMainForm form, string file) { EmmitFromFile(form,new FileInfo(file)); }