public void InitExtensionControl(ExtensionArgs args) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { InitExtensionControl(args); })); return; } this.Controls.Clear(); if (args.extensions.Count > 0) { TabControl tab = new TabControl(); tab.Dock = DockStyle.Fill; foreach (var app in args.extensions) { UserControl tempForm = System.Activator.CreateInstance(app.Bundle.LoadClass(app.ExtensType)) as UserControl; if (null != tempForm) { tempForm.Dock = DockStyle.Fill; tab.TabPages.Add(app.ExtensText); tab.SelectTab((int)(tab.TabPages.Count - 1)); tempForm.Parent = tab.SelectedTab; this.Controls.Add(tab); } } tab.SelectTab(0); } }
protected override void OnCreate(ExtensionArgs args) { base.OnCreate(args); ClassExtensionScanner scanner = new ClassExtensionScanner(GetType()); scanner.Scan(ClassExtensionScanner.ScanOption.Informations); var infos = scanner.Informations; _cn = infos[DpmReceiverAttribute.KEY].Value as string; }
private void InjectProperty() { var args = new ExtensionArgs() { Wrapper = wrapper, CurrentProcess = this, TargetDevice = targetDevice }; Instance.Init(ctx, args); }
public void onExtensionChanged() { List <WinShellApplication> childrenExtensions = base.GetChildrenExtensions(Activator.Context); if (null != this.OnExtensionChanged) { ExtensionArgs args = new ExtensionArgs { extensions = childrenExtensions }; this.OnExtensionChanged(this, args); } }
public void InitExtensionControl(ExtensionArgs args) { try { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { InitExtensionControl(args); })); return; } this.Controls.Clear(); int i = 0; int startIndex = (SystemInformation.PrimaryMonitorSize.Width - args.extensions.Count * 120) / 2; foreach (var app in args.extensions) { ControlButton btn = new ControlButton(); if (!string.IsNullOrEmpty(app.Icon)) { btn.PicImage = app.Icon; } btn.TitleName = app.ExtensText; btn.Size = new System.Drawing.Size(120, 80); btn.Location = new Point(startIndex + 119 * i, 0); i++; PictureBox pb = btn.Controls.Find("picLogo", false)[0] as PictureBox; pb.Tag = app; pb.Click += new EventHandler(btn_Click); this.Controls.Add(btn); } ///////////////////////////加载数据库状态图标///////////////////////////////////// PictureBox picDbStatus = new PictureBox(); picDbStatus.Size = new System.Drawing.Size(30, 30); picDbStatus.Name = "DBStatus"; picDbStatus.Image = new Bitmap(GlobalEnvironment.BasePath + @"\image\Signal.png"); picDbStatus.Location = new Point(SystemInformation.PrimaryMonitorSize.Width - 100, 30); this.Controls.Add(picDbStatus); //数据库连接状态 this.timerDBTesting.Stop(); this.timerDBTesting.Interval = 3000; this.timerDBTesting.Tick += new EventHandler(timerDBTesting_Tick); timerDBTesting.Start(); } catch (Exception ex) { LogHelper.Log.Error(ex.Message); } }
public void InitExtensionControl(ExtensionArgs args) { if (null == GlobalEnvironment.WorkStationInfo) { return; } WorkBenchHeight = this.Height - topTitleHeight - bottomTitleHeight; if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { InitExtensionControl(args); })); return; } var pluginBLL = EngineContext.Current.Resolve <IFN_LAYOUT_SUBJECT>(); var plugins = pluginBLL.GetPlugins(GlobalEnvironment.WorkStationInfo.ID); //this.Controls.Clear(); foreach (var pluginInfo in plugins) { var app = args.extensions.Where(x => x.ExtensName == pluginInfo.CLIENT_TYPE).FirstOrDefault(); if (null != app) { UserControl tempForm = System.Activator.CreateInstance(app.Bundle.LoadClass(app.ExtensType), new object[] { pluginInfo }) as UserControl; tempForm.Width = (int)(pluginInfo.WIDTH * this.Width / 100); tempForm.Height = (int)(pluginInfo.HEIGHT * this.Height / 100); int left = (int)(pluginInfo.LEEF_X * this.Width / 100); int top = (int)(pluginInfo.LEEF_Y * this.Height / 100) + topTitleHeight; top = top + topTitleHeight > this.Height ? (this.Height - tempForm.Height) : top; tempForm.Location = new Point(left, top); this.Controls.Add(tempForm); } } }
/// <summary> /// 添加控件 /// </summary> /// <param name="extensions"></param> public void Instance_OnExtensionChanged(object sender, ExtensionArgs args) { InitExtensionControl(args); }
public void InitExtensionControl(ExtensionArgs args) { MethodInvoker method = null; try { if (base.InvokeRequired) { if (method == null) { method = () => this.InitExtensionControl(args); } base.Invoke(method); } else { List <FN_LAYOUT_SUBJECT> plugins = EngineContext.Current.Resolve <IFN_LAYOUT_SUBJECT>().GetPlugins(GlobalEnvironment.WorkStationInfo.ID, this._Plugin.ID); using (List <FN_LAYOUT_SUBJECT> .Enumerator enumerator = plugins.GetEnumerator()) { Func <WinShellApplication, bool> predicate = null; FN_LAYOUT_SUBJECT pluginInfo; while (enumerator.MoveNext()) { pluginInfo = enumerator.Current; if (predicate == null) { predicate = x => x.ExtensName == pluginInfo.CLIENT_TYPE; } WinShellApplication application = args.extensions.Where <WinShellApplication>(predicate).FirstOrDefault <WinShellApplication>(); if (null != application) { decimal? nullable2; UserControl control = System.Activator.CreateInstance(application.Bundle.LoadClass(application.ExtensType), new object[] { pluginInfo }) as UserControl; decimal? wIDTH = pluginInfo.WIDTH; decimal width = base.Width; nullable2 = (wIDTH.HasValue ? new decimal?(wIDTH.GetValueOrDefault() * width) : ((decimal?)(nullable2 = null))) / 100M; control.Width = (int)nullable2.Value; wIDTH = pluginInfo.HEIGHT; width = base.Height; nullable2 = (wIDTH.HasValue ? new decimal?(wIDTH.GetValueOrDefault() * width) : ((decimal?)(nullable2 = null))) / 100M; control.Height = (int)nullable2.Value; wIDTH = pluginInfo.LEEF_X; width = base.Width; nullable2 = (wIDTH.HasValue ? new decimal?(wIDTH.GetValueOrDefault() * width) : ((decimal?)(nullable2 = null))) / 100M; int num = (int)nullable2.Value; wIDTH = pluginInfo.LEEF_Y; width = base.Height; nullable2 = (wIDTH.HasValue ? new decimal?(wIDTH.GetValueOrDefault() * width) : ((decimal?)(nullable2 = null))) / 100M; int y = ((int)nullable2.Value) + this.topTitleHeight; y = ((y + this.topTitleHeight) > base.Height) ? (base.Height - control.Height) : y; control.Location = new Point(num, y); base.Controls.Add(control); } } } } } catch (Exception exception) { LogHelper.Log.Error(exception.Message); } }
public ExtensionDialog(ExtensionArgs args) { InitializeComponent(); newExtension = args.NewExtension; }