public void Build(IEnumerable <XmlNode> xmlNodes, IBundle owner) { foreach (XmlNode item in xmlNodes) { Build(item, owner); } }
/// <summary> /// Initializes a new instance of the <see cref="T:UngroupCommand"/> class. /// </summary> /// <param name="controller">The controller.</param> /// <param name="group">The group.</param> public UngroupCommand(IController controller, IGroup group) : base(controller) { this.Text = "Ungroup"; this.controller = controller; this.mGroup = group; bundle = new Bundle(); }
/// <summary> /// 移除扩展点 /// </summary> /// <param name="item"></param> public void RemoveExtensionPoint(IExtensionPoint item) { lock (lockObj) { if (item == null) { return; } string key = item.Point.ToLower(); if (extensionPointsByName.Contains(key)) { // 从根据名称存贮扩展点集合中移除 extensionPointsByName.Remove(key); // 从以插件名存贮的扩展点集合中移除 IBundle bundle = item.Owner; key = bundle.ToString(); ListDictionary eps = extensionPointsByBundle[key] as ListDictionary; if (!eps.Contains(item.Point)) { return; } eps.Remove(item.Point); // 从扩展点列表中移除 extensionPoints.Remove(item); // 检索扩展点所有的扩展 foreach (IExtension extension in item.Extensions) { // 从扩展列表中删除 extensions.Remove(extension); } } } }
/// <summary> /// Initializes a new instance of the <see cref="T:GroupCommand"/> class. /// </summary> /// <param name="controller">The controller.</param> /// <param name="bundle">The bundle.</param> public GroupCommand(IController controller, IBundle bundle) : base(controller) { this.Text = "Group"; this.controller = controller; this.bundle = bundle;//the bundle should contain only IShape and IConnection entities! }
public override void Build(XmlNode xmlNode, IBundle owner) { ToolStripItem newItem = ToolbarItemBuilder.Build(xmlNode, owner); Items.Add(newItem); OnItemAdded(newItem); }
public static TViewModel Get <TViewModel>( [NotNull] IViewModelStoreOwner owner, [NotNull] string key, [CanBeNull] IBundle stateBundle) where TViewModel : class, IViewModel, IViewModelWithState { if (owner == null) { throw new ArgumentNullException(nameof(owner)); } if (key == null) { throw new ArgumentNullException(nameof(key)); } if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(key)); } var store = owner.GetViewModelStore(); var viewModel = store.Get <TViewModel>(key); if (viewModel == null) { viewModel = Get <TViewModel>(GetFactory(), stateBundle); store.Set <TViewModel>(key, viewModel); } return(viewModel); }
public object Visit(Property expr) { //TODO: built-in properties for strings and numbers here? IBundle bundle = (IBundle)Evaluate(expr.expression); return(bundle.Property(this, expr.name, expr.name.lexeme)); }
protected override void OnCreate(IBundle bundle) { this.viewLocator = Context.GetApplicationContext().GetService <IUIViewLocator>(); this.viewModel = new StartupViewModel(); //this.subscription = this.viewModel.Messenger.Subscribe (); //this.SetDataContext (viewModel); /* databinding, Bound to the ViewModel. */ BindingSet <StartupWindow, StartupViewModel> bindingSet = this.CreateBindingSet(viewModel); bindingSet.Bind().For(v => v.OnOpenLoginWindow).To(vm => vm.LoginRequest); bindingSet.Bind().For(v => v.OnDismissRequest).To(vm => vm.DismissRequest); bindingSet.Bind(this.progressBarSlider).For("value", "onValueChanged").To("ProgressBar.Progress").TwoWay(); //bindingSet.Bind (this.progressBarSlider).For (v => v.value, v => v.onValueChanged).To (vm => vm.ProgressBar.Progress).TwoWay (); /* //by the way,You can expand your attributes. * ProxyFactory proxyFactory = ProxyFactory.Default; * PropertyInfo info = typeof(GameObject).GetProperty ("activeSelf"); * proxyFactory.Register (new ProxyPropertyInfo<GameObject, bool> (info, go => go.activeSelf, (go, value) => go.SetActive (value))); */ bindingSet.Bind(this.progressBarSlider.gameObject).For(v => v.activeSelf).To(vm => vm.ProgressBar.Enable).OneWay(); bindingSet.Bind(this.progressBarText).For(v => v.text).ToExpression(vm => string.Format("{0}%", Mathf.FloorToInt(vm.ProgressBar.Progress * 100f))).OneWay();/* expression binding,support only OneWay mode. */ bindingSet.Bind(this.tipText).For(v => v.text).To(vm => vm.ProgressBar.Tip).OneWay(); //bindingSet.Bind(this.button).For(v => v.onClick).To(vm=>vm.OnClick()).OneWay(); //Method binding,only bound to the onClick event. bindingSet.Bind(this.button).For(v => v.onClick).To(vm => vm.Click).OneWay();//Command binding,bound to the onClick event and interactable property. bindingSet.Build(); this.viewModel.Unzip(); }
/// <summary> /// 框架事件 /// </summary> /// <param name="bundle">组件对象</param> /// <param name="state">状态</param> /// <param name="exception">异常信息</param> public FrameworkEventArgs(IBundle bundle, FrameworkState state, Exception exception) { this.bundle = bundle; this.state = state; this.exception = exception; }
public static void SetupBundler(IBundleProvider bundleProvider) { var scriptBundleBuilder = bundleProvider.CreateScriptBundle(async: false); var styleBundleBuilder = bundleProvider.CreateLessBundle(); // Scripts scriptBundleBuilder .AddFile("~/Scripts/jquery-1.10.2.js") .AddFile("~/Scripts/jquery.validate.js") .AddFile("~/Scripts/modernizr-2.6.2.js") .AddFile("~/Scripts/bootstrap.js") .AddFile("~/Scripts/respond.js"); // Styles styleBundleBuilder .AddFile("~/Content/bootstrap.css") .AddFile("~/Content/site.css"); // Create bundles ScriptBundle = scriptBundleBuilder.Create(); StyleBundle = styleBundleBuilder.Create(); // Add bundles to bundle provider if (!bundleProvider.Add(ApplicationScriptsBundleKey, ScriptBundle)) { throw new Exception("Can't setup script bundle."); } if (!bundleProvider.Add(ApplicationStylesBundleKey, StyleBundle)) { throw new Exception("Can't setup style bundle."); } }
private void SelectBundle() { object selectedItem = BundlesDataGrid.SelectedItem; IBundleManagementService defaultOrFirstService = BundleActivator.BundleManagementServiceTracker.DefaultOrFirstService; if (selectedItem != null && defaultOrFirstService != null) { IBundle bundle = selectedItem as IBundle; bool isEnabled = defaultOrFirstService.IsBundleAllowedToStart(bundle.BundleID); bool isEnabled2 = defaultOrFirstService.IsBundleAllowedToStop(bundle.BundleID); bool isEnabled3 = defaultOrFirstService.IsBundleAllowedToUninstall(bundle.BundleID); StartButton.IsEnabled = isEnabled; StopButton.IsEnabled = isEnabled2; UninstallButton.IsEnabled = isEnabled3; StartButton.Visibility = ((bundle.State == BundleState.Active) ? Visibility.Hidden : Visibility.Visible); StopButton.Visibility = ((bundle.State != BundleState.Active) ? Visibility.Hidden : Visibility.Visible); UninstallButton.Visibility = Visibility.Visible; SelectedBundleTextBlock.Text = $"当前插件:{bundle.Name}"; } else { SelectedBundleTextBlock.Text = string.Empty; StartButton.Visibility = Visibility.Hidden; StopButton.Visibility = Visibility.Hidden; UninstallButton.Visibility = Visibility.Hidden; } }
/// <summary> Processes the given marc file and creates an instance of <see cref="IPluginInfo"/>. </summary> /// <param name="bundle">Marc file to process</param> /// <returns>Instance of PluginInfo or null</returns> private IPluginInfo RegisterBundle(IBundle bundle) { _log.Debug($"Processing bundle '{bundle}'"); try { Stream signatureFileStream = bundle.GetResourceAsStream("signature.mf"); if (signatureFileStream == null) { _log.Debug("No signature file found. Plug-in will not be available!"); return(null); } _log.Debug("Signature file found"); IPluginSignature pluginSignature; using (signatureFileStream) { pluginSignature = SignatureFactory.Instance.CreateSignature(signatureFileStream); _log.Debug($"Resolved plug-in signature '{pluginSignature}'"); } IPluginInfo pluginInfo = PluginFactory.Instance.CreatePluginInfo(bundle, pluginSignature); _log.Debug($"Resolved plug-in info '{pluginInfo}'"); return(pluginInfo); } catch (Exception ex) { string message = $"Could not process marc file '{bundle}'. Plug-in will not be available!"; _log.Error(message, ex); } return(null); }
public void Add(IBundle include) { var fisAdd = new List<string>(); for (int index = 0; index < include.FisicalAddresses.Count; index++) { var item = include.FisicalAddresses[index].Trim('/'); if (item.StartsWith("~")) { item = item.Trim('~', '/'); item = "/" + item; } if (item.Contains("{") || item.Contains("*")) { fisAdd.AddRange(FindRealPaths(item)); } else { fisAdd.Add("/" + _virtualDir +item); } } var script = include as ScriptBundle; if (script != null) { _script[script.LogicalAddress] = new ScriptBundle(script.LogicalAddress, fisAdd); } else { var style = include as StyleBundle; if (style != null) { _style[style.LogicalAddress] = new StyleBundle(style.LogicalAddress, fisAdd); } } }
public void AddRange(IBundle owner, IEnumerable <object> serviceInstance) { foreach (object current in serviceInstance) { Add(owner, current); } }
public void RemoveService(IBundle owner, Type serviceType, object serviceInstance) { if (_serviceCollection.RemoveServiceInstance(owner, serviceType, serviceInstance) == 0) { return; } }
/// <summary> /// 解析操作 /// </summary> /// <param name="element"></param> /// <param name="bundle"></param> /// <returns></returns> protected override void OnResolver(XElement element, IBundle bundle) { // 检查是否符合规范,并起始于ribbon节点 if (!element.Name.LocalName.Equals("ribbon")) { return; } // 检查ribbon子节点,有且仅有一个tabs节点 IEnumerable <XElement> xTabsElements = element.Elements(xns + "tabs"); if (xTabsElements == null && xTabsElements.Count() != 1) { return; } XElement xTabsElement = xTabsElements.FirstOrDefault(); // 获取所有的tab节点 IEnumerable <XElement> xTabs = xTabsElement.Elements(xns + "tab"); if (xTabs == null || xTabs.Count() == 0) { return; } // 遍历所有的tab节点 foreach (XElement xTab in xTabs) { // 根据元素类型解析器 IRibbonResolver tabResolver = CreateResolver(xTab.Name.LocalName, ribbonAdmin); // 解析Tab元素 if (tabResolver != null) { tabResolver.Resolve(xTab, bundle); } } }
/// <summary> /// Initializes a new instance of the <see cref="T:MoveCommand"/> class. /// </summary> /// <param name="controller">The controller.</param> /// <param name="bundle">The bundle.</param> /// <param name="delta">The delta.</param> public MoveCommand(IController controller, IBundle bundle, Point delta) : base(controller) { this.Text = "Move " + bundle.EntityName; this.controller = controller; this.delta = delta; this.bundle = bundle; }
/// <summary> /// 解析操作 /// </summary> /// <param name="element"></param> /// <param name="bundle"></param> /// <returns></returns> protected override void OnResolver(XElement element, IBundle bundle) { // 首先获取当前页签的唯一标示 string id = element.AttibuteStringValue("id"); if (string.IsNullOrEmpty(id)) { return; } // 获取上级容器的唯一标示 string containerId = element.Parent.AttibuteStringValue("id"); // 检查缓存中是否存在 if (ribbonAdmin.Contains <T>(id)) { return; } // 创建指定类型的对象 T xRibbonElement = Activator.CreateInstance <T>(); bool success = xRibbonElement.InitProperties(element, bundle); if (!success) { return; } // 将当前元素的容器 CompositeRibbonElement xRibbonContainer = ribbonAdmin.Find <CompositeRibbonElement>(containerId); xRibbonContainer.Append(xRibbonElement); // 添加到缓存 ribbonAdmin.CacheRibbonElement(id, xRibbonElement); }
private object menuCommand; //ICommand or IViewProvider public ToolBarCommand(XmlNode node, IBundle owner, bool createCommand) { RightToLeft = RightToLeft.Inherit; this.node = node; this.owner = owner; if (createCommand) { LoadClass(); } if (Image == null) { string icon = XmlUtility.ReadAttribute(node, "icon"); if (!string.IsNullOrEmpty(icon)) { Image = ResourcesUtility.TryGetBitmap(owner.LoadResource(icon, ResourceLoadMode.ClassSpace)); } } Text = XmlUtility.ReadAttribute(node, "text"); ToolTipText = XmlUtility.ReadAttribute(node, "tooltip"); commandName = XmlUtility.ReadAttribute(node, "command"); if (!string.IsNullOrEmpty(commandName)) { _statusMonitor = new CommandStatusMonitor(commandName, enable => Enabled = enable, visible => Visible = visible); } }
private void SetBundle(IBundle bundle, string bundleName) { lock (this) { _bundleRefCounts[bundleName].SetBundle(bundle); } }
/// <summary> /// Returns an instance of <see cref="ICustomMenuConfigurer"/> if any has been registered /// using the associated extension point. If no type has been contributed, NULL is returned. /// </summary> /// <returns>An instance of <see cref="ICustomMenuConfigurer"/> or NULL</returns> private static ICustomMenuConfigurer GetCustomMenuConfigurer() { IConfigurationElement[] customMenuConfigurerElements = ExtensionService.Instance.GetConfigurationElements(ExtensionPointIdCustomMenuConfigurer); if (customMenuConfigurerElements == null || customMenuConfigurerElements.Length == 0) { return(null); } IConfigurationElement customMenuConfigurationElement = customMenuConfigurerElements[0]; string id = customMenuConfigurationElement["id"]; string clsName = customMenuConfigurationElement["class"]; if (string.IsNullOrEmpty(clsName)) { return(null); } IBundle providingBundle = ExtensionService.Instance.GetProvidingBundle(customMenuConfigurationElement); try { Type instanceType = TypeLoader.TypeForName(providingBundle, clsName); return(instanceType.NewInstance <ICustomMenuConfigurer>()); } catch (Exception ex) { ILog logWriter = LogManager.GetLog(typeof(MenuItemProvider)); logWriter.Error( "Error on creating instance of custom menu configurer. " + $"Id is '{id}'. Providing bundle is '{providingBundle}'", ex); return(null); } }
protected override void OnCreate(IBundle bundle) { //RewardViewModel rewardViewModel = new RewardViewModel(); //this.SetDataContext(rewardViewModel); this.toastInteractionAction = new ToastInteractionAction(this); BindingSet <RewardWindow, RewardViewModel> bindingSet = this.CreateBindingSet <RewardWindow, RewardViewModel>(); bindingSet.Bind().For(v => v.Coupons).To(vm => vm.Coupons).OneWay(); bindingSet.Bind(this.image).For(v => v.sprite).To(vm => vm.Icon).WithConversion("merchandiseConverter").OneWay(); bindingSet.Bind(this.phoneNumber).For(v => v.text, v => v.onEndEdit).To(vm => vm.PhoneNumber).TwoWay(); bindingSet.Bind().For(v => v.OnOpenAlert).To(vm => vm.AlertDialogRequest); bindingSet.Bind(this.receiveReward).For(v => v.onClick).To(vm => vm.ReceiveReward).OneWay(); bindingSet.Bind(this.terminate).For(v => v.onClick).To(vm => vm.Terminate).OneWay(); bindingSet.Bind().For(v => v.OnInteractionFinished).To(vm => vm.InteractionFinished); bindingSet.Bind(this.countDown).For(v => v.text).ToExpression(vm => string.Format("{0}", vm.CountDown)).TwoWay(); bindingSet.Bind().For(v => v.toastInteractionAction).To(vm => vm.ToastRequest); bindingSet.Build(); }
protected override void OnCreate(IBundle bundle) { /* Create Window View */ this.WindowType = WindowType.FULL; this.localWindowManager = this.CreateWindowManager(); }
private void ReleaseExtension(IBundle bundle) { Func <Extension, bool> comparer = null; Func <ExtensionPoint, bool> func2 = null; Dictionary <string, List <Extension> > dictionary = new Dictionary <string, List <Extension> >(); List <ExtensionPoint> list = new List <ExtensionPoint>(); using (ReaderWriterLockHelper.CreateWriterLock(this._locker)) { foreach (KeyValuePair <string, List <Extension> > pair in this.Extensions) { if (comparer == null) { comparer = item => item.Owner == bundle; } dictionary[pair.Key] = ListUtility.RemoveAll <Extension>(pair.Value, comparer); } if (func2 == null) { func2 = item => item.Owner == bundle; } list = ListUtility.RemoveAll <ExtensionPoint>(this.ExtensionPoints, func2); } foreach (KeyValuePair <string, List <Extension> > pair2 in dictionary) { this.FireExtensionsChanged(pair2.Key, CollectionChangedAction.Remove, pair2.Value); } foreach (ExtensionPoint point in list) { this.FireExtensionPointChanged(CollectionChangedAction.Remove, point); } }
public FragementBundleLoader(IBundle bundle) : base(bundle) { var fragmentBundle = bundle as FragmentBundle; Framework = fragmentBundle.Framework; }
protected override void OnCreate(IBundle bundle) { ApplicationContext context = Context.GetApplicationContext(); this.localization = context.GetService <Localization> (); var accountService = context.GetService <IAccountService> (); var globalPreferences = context.GetGlobalPreferences(); this.viewModel = new LoginViewModel(accountService, localization, globalPreferences); this.loginCommand = new SimpleCommand(Login); this.viewModel.LoginCommand = this.loginCommand; BindingSet <LoginWindow, LoginViewModel> bindingSet = this.CreateBindingSet(viewModel); bindingSet.Bind(this.username).For(v => v.text, v => v.onEndEdit).To(vm => vm.Username).TwoWay(); bindingSet.Bind(this.usernameErrorPrompt).For(v => v.text).To(vm => vm.Errors ["username"]).OneWay(); bindingSet.Bind(this.password).For(v => v.text, v => v.onEndEdit).To(vm => vm.Password).TwoWay(); bindingSet.Bind(this.passwordErrorPrompt).For(v => v.text).To(vm => vm.Errors ["password"]).OneWay(); bindingSet.Bind(this.confirmButton).For(v => v.onClick).To(vm => vm.LoginCommand); bindingSet.Build(); this.cancelButton.onClick.AddListener(() => { this.Dismiss(); this.RaiseOnLoginFinish(false, null); }); }
public override object LoadResource(string resourceName, ResourceLoadMode resourceLoadMode) { Predicate <IBundleMetadata> match = null; Predicate <IFragmentBundleMetadata> predicate2 = null; object result = base.LoadResource(resourceName, resourceLoadMode); if ((result == null) && ((resourceLoadMode == ResourceLoadMode.LocalAndFragment) || (resourceLoadMode == ResourceLoadMode.ClassSpace))) { if (match == null) { match = a => a.BundleID == Bundle.BundleID; } Interface1 interface2 = FrameworkAdaptor.State.Bundles.Find(match) as Interface1; if (predicate2 == null) { predicate2 = delegate(IFragmentBundleMetadata a) { IBundle bundle = Framework.Bundles.Find(bundle => bundle.BundleID == a.BundleID); if (bundle == null) { return(false); } return((result = bundle.LoadResource(resourceName, resourceLoadMode)) != null); }; } if (interface2.Fragments.Exists(predicate2)) { return(result); } } return(result); }
/// <summary> /// 添加扩展点 /// </summary> /// <param name="point"></param> public void AddExtensionPoint(IExtensionPoint item) { lock (lockObj) { if (item == null) { return; } string key = item.Point.ToLower(); if (extensionPointsByName.Contains(key)) { IBundle bundle = item.Owner; key = bundle.ToString(); extensionPointsByName.Add(key, item); if (extensionPointsByBundle.Contains(key)) { ListDictionary eps = extensionPointsByBundle[key] as ListDictionary; if (eps.Contains(item.Point.ToLower())) { return; } eps.Add(item.Point, item); extensionPoints.Add(item); } else { ListDictionary eps = new ListDictionary(); eps.Add(item.Point, item); extensionPoints.Add(item); extensionPointsByBundle.Add(key, eps); } } } }
/// <summary> /// 根据XML对象设置当前元素的属性值 /// </summary> /// <param name="element"></param> public override bool InitProperties(XElement element, IBundle bundle) { bool success = false; // 获取页签的唯一标识 this.Id = element.AttibuteStringValue("id"); if (string.IsNullOrEmpty(this.Id)) { return(success); } // 获取页签名列类型 string className = element.AttibuteStringValue("type"); if (string.IsNullOrEmpty(className)) { return(success); } // 创建页签的命令类型 this.command = RibbonUtils.NewInstance <RibbonGroupCommand>(className, bundle); if (this.command == null) { return(success); } this.command.XRibbonElement = this; return(true); }
/// <summary> /// 获取所有Bundle模块 /// </summary> /// <returns>所有已装载Bundle列表</returns> public IList <IBundle> GetBundles() { var bundles = new IBundle[bundleList.Count]; bundleList.CopyTo(bundles, 0); return(bundles.ToList()); }
public void Build(XmlNodeList nodeList, IBundle owner) { for (int i = 0; i < nodeList.Count; i++) { Build(nodeList[i], owner); } }
/// <summary> /// 触发扩展变更事件 /// </summary> /// <param name="bundle">引发的模块</param> /// <param name="extensionEventArgs">扩展事件参数</param> public void FireExtensionChanged(IBundle bundle, ExtensionEventArgs extensionEventArgs) { if (this.ExtensionChanged != null) { this.ExtensionChanged(bundle, extensionEventArgs); } }
protected override void OnCreate(IBundle bundle) { BindingSet <WheelWindow, WheelViewModel> bindingSet = this.CreateBindingSet <WheelWindow, WheelViewModel>(); bindingSet.Bind().For(v => v.Items).To(vm => vm.Items).OneWay(); bindingSet.Bind(this).For(v => v.OnSelectChanged).To <int>(vm => vm.Select).OneWay(); bindingSet.Bind(this.drawButton).For(v => v.onClick).To(vm => vm.DrawCommand).OneWay(); bindingSet.Bind(this.drawImage).For(v => v.sprite).To(vm => vm.DrawIcon).WithConversion("wheelConverter").OneWay(); //bindingSet.Bind(this.hintImage).For(v => v.sprite).To(vm => vm.HintIcon).WithConversion("wheelConverter").OneWay(); bindingSet.Bind().For(v => v.WheelTurn).To(vm => vm.WheelTurnRequest); bindingSet.Bind().For(v => v.OnOpenCardBagWindow).To(vm => vm.CardBagRequest); //bindingSet.Bind(this.awardView).For(v => v.Awards).To(vm => vm.Awards).OneWay(); bindingSet.Bind().For(v => v.OnOpenDrawDialog).To(vm => vm.DrawDialogRequest); bindingSet.Bind().For(v => v.OnShowPayDialog).To(vm => vm.PayDialogRequest); bindingSet.Bind().For(v => v.OnDismissRequest).To(vm => vm.DismissRequest); bindingSet.Build(); this.rule.onClick.AddListener(RuleAnimation); WheelViewModel wheelViewModel = this.GetDataContext() as WheelViewModel; this.awardView.BindingContext().DataContext = wheelViewModel.AwardViewModel; }
public override void Build(XmlNode xmlNode, IBundle owner) { MenuItem newItem = MenuItemParser.Build(xmlNode, owner); Items.Add(newItem); OnItemAdded(newItem); }
/// <summary> /// 触发服务变更事件 /// </summary> /// <param name="bundle">引发的模块</param> /// <param name="serviceEventArgs">服务事件参数</param> public void FireServiceChanged(IBundle bundle, ServiceEventArgs serviceEventArgs) { if (this.ServiceChanged != null) { this.ServiceChanged(bundle, serviceEventArgs); } }
public WinShellApplication(string title, string tooltip, string icon, IBundle bundle) { Title = title; ToolTip = tooltip; Icon = icon; Bundle = bundle; Menus = new List<WinShellMenu>(); }
public ExtensionProviderHandler(IBundle bundle) { _bundle = bundle; HandleBootstrapLayoutExtensions(); bundle.Context.ExtensionChanged += Context_ExtensionChanged; }
private static async Task CreateUserIfNotExists(IBundle bundle, string email) { // note: must be a command var userExists = await bundle.Query(new EmailExists() { Email = email }); if (!userExists) { await bundle.Do(new CreateUser() { Email = email }); Console.WriteLine("\tuser {0} created", email); } else { Console.WriteLine("\tuser {0} exists", email); } }
public void RemoveWeChatProxy(string name, IBundle bundle) { if (!string.IsNullOrEmpty(name)) { var serviceProxies = Activator.WeChatProxyContainer.ServiceWeChatProxies; var item = serviceProxies.Where(i => i.Name == name && i.Bundle == bundle).FirstOrDefault(); if (serviceProxies.Contains(item)) serviceProxies.Remove(item); } else FileLogUtility.Error(string.Format("Name hould not be empty when calling RemoveWeChatProxy in IWeChatProxyService from Bundle {0}.", bundle.SymbolicName)); }
public bool IsAssignableTo(IBundle requester, string className) { // Always return true if the requester is the same as the provider. // if (requester == bundle) // { return true; // } // Boolean flag. // bool allow = true; // return allow; }
////////////////////////////////////////////////////////////////////////// public IBundle[] getBundles() { lock (m_lock) { int i = 0; IBundle[] ret = new IBundle[m_bundlesByID.Count]; foreach (CBundle bndl in m_bundlesByID.Values) ret[i++] = bndl; return ret; } }
public void AddWeChatProxy(string name, string token, string hanlder, IBundle bundle, string appid, string secret) { if (!string.IsNullOrEmpty(hanlder) && !string.IsNullOrEmpty(token)) { var item = Activator.WeChatProxyContainer.WeChatProxies.Where(i => i.Token == token).FirstOrDefault(); if (item == null) Activator.WeChatProxyContainer.ServiceWeChatProxies.Add(new WeChatProxy() { Name = name, Token = token, Handler = hanlder, Bundle = bundle, AppID = appid, Secret = secret }); else FileLogUtility.Error(string.Format("{0} provides the same Token {1} that has been registered when calling AddWeChatProxy in IWeChatProxyService so it's ignored.", bundle.SymbolicName, token)); } else FileLogUtility.Error(string.Format("Hander and Token should not be empty when calling AddWeChatProxy in IWeChatProxyService from Bundle {0}.", bundle.SymbolicName)); }
public ServiceRegistration(BundleContext context, string[] classes, object serviceObject, Dictionary<string, object> properties) { this.context = context; this.bundle = context.Bundle; this.framework = context.Framework; this.classes = classes; this.serviceObject = serviceObject; this.serviceId = framework.GetNextServiceId(); this.referance = new ServiceReference(this, bundle); this.contextsUsing = null; this.factory = serviceObject as IServiceFactory; available = true; InitializeProperties(properties); framework.ServiceRegistry.PublishService(context, this); EventManager.OnServiceChanged(new ServiceEventArgs(ServiceState.Registered, referance)); }
public BundleEventArgs(BundleTransition transition, IBundle bundle) { this.mbundle = bundle; this.transition = transition; }
public ServiceReference(ServiceRegistration registration, IBundle bundle) { this.registration = registration; this.bundle = bundle; }
/// <summary> /// Start Bundle and add Assembly to TopLevelReferencedAssemblies /// (note: web application need Assembly to TopLevelReferencedAssemblies) /// </summary> /// <param name="bundle">bundle</param> private static void StartBundle(IBundle bundle) { Assembly ass = null; //加载组件程序集 ass = GetAssemblyForLocation(bundle.Location); //启动组件 mFramework.StartBundle(bundle); //将web项目的dll加入到动态编译区 if (null != mTopLevelReferencedAssemblies && bundle.DataInfo.Runtime.Assemblie.IsWeb) { mTopLevelReferencedAssemblies.Add(ass); } }
public static Bitmap FromBundle(IBundle bundle, Graphics g) { // The entities will be drawn to our graphics surface using // their locations on the canvas. We want them to be drawn // relative to the 0,0 (upper, left corner) of our image. // Therefore, calculate the offset required to position them // (normalize) in our image and apply that translation to // g2, the GDI+ drawing surface used to paint the entities to // the image. Notice we're actually calculating the offset // relative to location 5,5. We adjusting the image height // and widht by 10 to ensure we catch everything, so by using // location 5,5 here we kept things centered. Point offset = new Point( 5 - bundle.Rectangle.X, 5 - bundle.Rectangle.Y); Matrix matrix = new Matrix(); matrix.Translate(offset.X, offset.Y); Rectangle bundleArea = bundle.Rectangle; // bundleArea.Inflate(5, 5); Bitmap image = new Bitmap( bundleArea.Width + 10, bundleArea.Height + 10, g); Graphics g2 = Graphics.FromImage(image); g2.Transform = matrix; // The background color is a weird blue, so I'm filling the // entire area first with a white color to get around this. g2.Clear(Color.White); g2.SmoothingMode = SmoothingMode.HighQuality; g2.CompositingQuality = CompositingQuality.HighQuality; g2.InterpolationMode = InterpolationMode.HighQualityBicubic; // Deselect and set Hovered to 'false' for all entities so // they're drawn to the image in their *normal* state. bundle.DeSelectAll(); bundle.SetHovered(false); bundle.Paint(g2); g.Flush(); g2.Flush(); g.Dispose(); g2.Dispose(); //System.IntPtr dc1 = g.GetHdc(); //System.IntPtr dc2 = g2.GetHdc(); //BitBlt(dc2, 0, 0, width, height, dc1, 0, 0, 0x00CC0020); //g.ReleaseHdc(dc1); //g2.ReleaseHdc(dc2); //g.Dispose(); //g2.Dispose(); return image; }
public void Register(IBundle bundle) { lock (syncObj) { bundlesByInstallOrder.Add(bundle); bundlesById.Add(bundle.Id, bundle); bundlesBySymbolicName.Add(bundle.SymbolicName, bundle); } }
public BundleHandler(IBundle requestBundle, string bundleVirtualPath) { this.RequestBundle = requestBundle; this.BundleVirtualPath = bundleVirtualPath; }
/// <summary> /// 获取指定插件的WinShellApplication对象。 /// </summary> /// <param name="bundle">指定插件。</param> /// <returns>WinShellApplication对象。</returns> public WinShellApplication GetWinShellApplication(IBundle bundle) { foreach (WinShellApplication app in Applications) { if (app.Bundle.Equals(bundle)) return app; } return null; }
public BundleContext(IBundle bundle) { this.bundle = bundle; }
/// <summary> /// 从插件加载图像。 /// </summary> /// <param name="bundle">所在插件。</param> /// <param name="imageFullName">嵌入资源图像全名。</param> /// <returns>图像对象。</returns> private Image LoadImage(IBundle bundle, string imageFullName) { if (!string.IsNullOrEmpty(imageFullName)) { try { var resource = bundle.LoadResource(imageFullName, ResourceLoadMode.Local); if (resource != null) { return Image.FromStream((Stream)resource); } } catch { FileLogUtility.Error(string.Format("Failed to load image '{0}' from bundle '{1}'.", imageFullName, bundle.SymbolicName)); return null; } } return null; }
/// <summary> /// Creates a bundle event of the specified type. /// </summary> public BundleEvent(BundleEvent.Type type, IBundle bundle) { m_type = type; m_bundle = bundle; }
public void StartBundle(IBundle bundle) { if (bundle == null) { throw new ArgumentNullException("bundle"); } bundle.Start(); }
/// <summary> /// 获取指定插件的顶层菜单对象。 /// </summary> /// <param name="bundle">指定插件。</param> /// <returns>顶层菜单对象集合。</returns> public List<WinShellMenu> GetTopWinShellMenus(IBundle bundle) { WinShellApplication app = GetWinShellApplication(bundle); if (app != null) return app.Menus; return null; }
public IBundle[] GetUsingBundles() { lock (registrationLock) { if (state == RegistrationState.Unregistered) /* service unregistered */ { return (null); } if (contextsUsing == null) { return (null); } int size = contextsUsing.Count; if (size == 0) { return (null); } /* Copy list of BundleContext into an array of Bundle. */ IBundle[] bundles = new IBundle[size]; for (int i = 0; i < size; i++) { bundles[i] = ((BundleContext)contextsUsing[i]).Bundle; } return bundles; } }
private string BuildData(IBundle bundle) { var sb = new StringBuilder(); foreach (var item in bundle.FisicalAddresses) { AddItem(sb, item); } return sb.ToString(); }
public void Start(IBundleContext context) { Bundle = context.Bundle; }
public bool Unregister(IBundle bundle) { lock (syncObj) { // remove by install order bool found = bundlesByInstallOrder.Remove(bundle); if (!found) { return false; } // remove by bundle ID bundlesById.Remove(bundle.Id); bundlesBySymbolicName.Remove(bundle.SymbolicName); return true; } }
public static void Add(IBundle Bundle) { _bundles[Bundle.Url] = Bundle; }