/// <summary> /// Links the given KeyTipControl as the visual child of self. /// In the process sets various properties of the control. /// </summary> public void LinkKeyTipControl(DependencyObject keyTipElement, KeyTipControl keyTipControl) { Debug.Assert(_keyTipControl == null && keyTipControl.KeyTipAdorner == null); _keyTipControl = keyTipControl; _keyTipControl.KeyTipAdorner = this; _keyTipControl.Text = KeyTipService.GetKeyTip(keyTipElement).ToUpper(KeyTipService.GetCultureForElement(keyTipElement)); _keyTipControl.IsEnabled = (bool)keyTipElement.GetValue(UIElement.IsEnabledProperty); Style keyTipStyle = KeyTipService.GetKeyTipStyle(keyTipElement); _keyTipControl.Style = keyTipStyle; _keyTipControl.RenderTransform = _keyTipTransform; bool clearCustomProperties = true; if (keyTipStyle == null) { Ribbon.Ribbon ribbon = RibbonControlService.GetRibbon(PlacementTarget); if (ribbon != null) { // Use Ribbon properties if the owner element belongs to a Ribbon. keyTipStyle = KeyTipService.GetKeyTipStyle(ribbon); if (keyTipStyle != null) { _keyTipControl.Style = keyTipStyle; } else { clearCustomProperties = false; _keyTipControl.Background = ribbon.Background; _keyTipControl.BorderBrush = ribbon.BorderBrush; _keyTipControl.Foreground = ribbon.Foreground; } } } if (clearCustomProperties) { _keyTipControl.ClearValue(Control.BackgroundProperty); _keyTipControl.ClearValue(Control.BorderBrushProperty); _keyTipControl.ClearValue(Control.ForegroundProperty); } AddVisualChild(_keyTipControl); EnsureTransform(); }
void ComponentManager_ItemInitialized(object sender, RibbonItemEventArgs ev) { try { if (ComponentManager.Ribbon.FindTab("wizfds_id2586") == null) { Ribbon.Ribbon rb = new Ribbon.Ribbon(); //and remove the event handler #if ARX_APP Autodesk.Windows.ComponentManager.ItemInitialized -= new EventHandler <RibbonItemEventArgs>(ComponentManager_ItemInitialized); #elif BRX_APP //Autodesk.Windows.ComponentManager.ItemInitialized -= // new EventHandler<RibbonItemEventArgs>(ComponentManager_ItemInitialized); #endif } } catch (System.Exception e) { ed.WriteMessage("\nWizFDS exception:" + e.ToString()); } }
public void Initialize() { try { // Dll loading from resources string resourceName = ""; string resource = ""; AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { resourceName = new AssemblyName(args.Name).Name + ".dll"; resource = Array.Find(this.GetType().Assembly.GetManifestResourceNames(), element => element.EndsWith(resourceName)); #if DEBUG ed.WriteMessage(resourceName + "\n"); ed.WriteMessage(resource + "\n"); #endif using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource)) { Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return(Assembly.Load(assemblyData)); } }; var ico = Properties.Resources.defaultIco; syncCtrl = new SyncControl(); syncCtrl.CreateControl(); syncCtrl.Name = "wizFdsSyncControl"; syncCtrl.server = new acWebSocketServer(syncCtrl); syncCtrl.router = new acWebSocketRouter(); #if ARX_APP acDoc.SendStringToExecute("TASKBAR\n0\n", true, false, true); #endif //Ustawienie pojedynczego okna - ewentualnie przetrzymywać orginalną zmienną ed.WriteMessage("\n\nInitializing WizFDS ver. " + version); ed.WriteMessage("\nWizFDS sync turned on. Waiting for connection from web application ..."); // Ribbon if (ComponentManager.Ribbon == null) { //load the custom Ribbon on startup, but at this point //the Ribbon control is not available, so register for //an event and wait #if ARX_APP ComponentManager.ItemInitialized += new EventHandler <RibbonItemEventArgs>(ComponentManager_ItemInitialized); #elif BRX_APP //ComponentManager.ItemInitialized += // new EventHandler<RibbonItemEventArgs>(ComponentManager_ItemInitialized); #endif } else { //the assembly was loaded using NETLOAD, so the ribbon //is available and we just create the ribbon Ribbon.Ribbon rb = new Ribbon.Ribbon(); } } catch (System.Exception e) { ed.WriteMessage("\nWizFDS exception:" + e.ToString()); } }