void buttonBarItem_Click(object sender, Janus.Windows.ButtonBar.ItemEventArgs e) { INewsPaperControl item = (INewsPaperControl)((Janus.Windows.ButtonBar.ButtonBarItem)(sender)).Tag; if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0) { string Filename = Path.Combine(Application.StartupPath, "Plugins") + @"\" + item.getName() + ".dll"; Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); currentNewsPaperControl = Plugin; Point p = new Point(currentNewsPaperControl.getAttList().getLocation().X *zoomDegree, currentNewsPaperControl.getAttList().getLocation().Y *zoomDegree); Size s = new System.Drawing.Size(currentNewsPaperControl.getAttList().getSize().Width *zoomDegree, currentNewsPaperControl.getAttList().getSize().Height *zoomDegree); Plugin.getCtrl().Location = p; Plugin.getCtrl().Size = s; iObjNumber++; Plugin.getAttList().setInstanceName("Obj" + iObjNumber.ToString()); //Xử lý marker if (Plugin.getName() == "NewsPaperMarker") { lstMarker.Add(Plugin); } MarkerList.lstMarkerList = new List <string>(); foreach (INewsPaperControl c in lstMarker) { MarkerList.lstMarkerList.Add(c.getAttList().getInstanceName()); } break; } } } ((Control)(currentNewsPaperControl)).MouseDown += new MouseEventHandler(MainProgram_MouseDown); ((Control)(currentNewsPaperControl)).MouseUp += new MouseEventHandler(MainProgram_MouseUp); panelInnerScreen.Controls.Add((Control)currentNewsPaperControl); saveControlTraceAndSetRealLocationSize(); }
bool loadControlPlugin() { m_MyControlList = new NewsPaperControlManager(); if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0) { foreach (string Filename in Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll")) { Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); m_MyControlList.LstNewsPaperControl.Add(Plugin); } } } return(true); } return(false); }
void buttonBarItem_Click(object sender, Janus.Windows.ButtonBar.ItemEventArgs e) { INewsPaperControl item = (INewsPaperControl)((Janus.Windows.ButtonBar.ButtonBarItem)(sender)).Tag; if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0) { string Filename = Path.Combine(Application.StartupPath, "Plugins") + @"\" + item.getName() + ".dll"; Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); currentNewsPaperControl = Plugin; } } } ((Control)(currentNewsPaperControl)).MouseDown += new MouseEventHandler(MainProgram_MouseDown); ((Control)(currentNewsPaperControl)).MouseUp += new MouseEventHandler(MainProgram_MouseUp); panelInnerScreen.Controls.Add((Control)currentNewsPaperControl); preState.Add(currentNewsPaperControl.clone()); currentState.Add(currentNewsPaperControl); }
public static CNewspaper readXML(string filename) { CNewspaper news = new CNewspaper(); news.Directory = filename.Substring(0, filename.LastIndexOf("\\")); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filename); news.KindOfNews = xmlDoc.SelectSingleNode("//title").InnerText; news.Datetime = xmlDoc.SelectSingleNode("//date").InnerText; news.NumPages = int.Parse(xmlDoc.SelectSingleNode("//numpages").InnerText); news.Number = int.Parse(xmlDoc.SelectSingleNode("//number").InnerText); foreach (XmlNode n in xmlDoc.SelectNodes("//page")) { CPage p = new CPage(); p.HeightP = int.Parse(n.Attributes["height"].Value); p.WidthP = int.Parse(n.Attributes["width"].Value); string strBackURL = n.Attributes["backgroundURL"].Value; if (strBackURL == "") { p.StrBackground = ""; } else { p.StrBackground = news.Directory + "\\" + strBackURL; } foreach (XmlNode xmlNodeObject in n.SelectNodes("object")) { string strControlName = xmlNodeObject.SelectSingleNode("type").InnerText; for (int i = 0; i < MainProgram.m_MyControlList.LstNewsPaperControl.Count; i++) { if (MainProgram.m_MyControlList.LstNewsPaperControl[i].getName() == strControlName) { Assembly Asm = Assembly.LoadFile(MainProgram.m_MyControlList.LstNewsPaperControl[i].getDllPath()); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); Plugin.loadfromXML(xmlNodeObject.OuterXml, news.Directory + "\\"); p.lstNewsPaperControl.Add(Plugin); break; } } break; } } } foreach (XmlNode xmlNodeObject in n.SelectNodes("marker")) { string strControlName = "NewsPaperMarker"; for (int i = 0; i < MainProgram.m_MyControlList.LstNewsPaperControl.Count; i++) { if (MainProgram.m_MyControlList.LstNewsPaperControl[i].getName() == strControlName) { Assembly Asm = Assembly.LoadFile(MainProgram.m_MyControlList.LstNewsPaperControl[i].getDllPath()); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); Plugin.loadfromXML(xmlNodeObject.OuterXml, news.Directory + "\\"); p.lstNewsPaperControl.Add(Plugin); break; } } break; } } } news.LPages.Add(p); } foreach (CPage page in news.LPages) { List <INewsPaperControl> lstMarker = new List <INewsPaperControl>(); List <INewsPaperControl> lstControl = new List <INewsPaperControl>(); foreach (INewsPaperControl c in page.lstNewsPaperControl) { if (c.getName() == "NewsPaperMarker") { lstMarker.Add(c); } } ReCalculteRealLocation(page, lstMarker); } return(news); }