FileTabManager(IFileTabUIContextLocatorCreator fileTabUIContextLocatorCreator, FileTreeView fileTreeView, ITabManagerCreator tabManagerCreator, IFileTabContentFactoryManager fileTabContentFactoryManager, IFileTabManagerSettings fileTabManagerSettings, IWpfFocusManager wpfFocusManager, IDecompilationCache decompilationCache, [ImportMany] IEnumerable <Lazy <IReferenceFileTabContentCreator, IReferenceFileTabContentCreatorMetadata> > mefRefFactories) { this.fileTabManagerSettings = fileTabManagerSettings; this.fileTabUIContextLocatorCreator = fileTabUIContextLocatorCreator; this.fileTabContentFactoryManager = fileTabContentFactoryManager; this.wpfFocusManager = wpfFocusManager; this.decompilationCache = decompilationCache; this.refFactories = mefRefFactories.OrderBy(a => a.Metadata.Order).ToArray(); var tvElem = fileTreeView.TreeView.UIObject as UIElement; Debug.Assert(tvElem != null); if (tvElem != null) { tvElem.IsVisibleChanged += TreeView_IsVisibleChanged; isTreeViewVisible = tvElem.IsVisible; } this.fileTreeView = fileTreeView; this.fileTreeView.FileManager.CollectionChanged += FileManager_CollectionChanged; this.fileTreeView.SelectionChanged += FileTreeView_SelectionChanged; this.fileTreeView.NodesTextChanged += FileTreeView_NodesTextChanged; this.fileTreeView.NodeActivated += FileTreeView_NodeActivated; this.fileTreeView.TreeView.NodeRemoved += TreeView_NodeRemoved; this.tabManager = tabManagerCreator.Create(); this.tabGroupManager = this.tabManager.Create(new TabGroupManagerOptions(MenuConstants.GUIDOBJ_FILES_TABCONTROL_GUID)); this.tabGroupManager.TabSelectionChanged += TabGroupManager_TabSelectionChanged; this.tabGroupManager.TabGroupSelectionChanged += TabGroupManager_TabGroupSelectionChanged; }
private void InjectTab(ThingDef thingDef) { Debug.Log("Inject Tab"); if (thingDef.inspectorTabsResolved == null) { thingDef.inspectorTabsResolved = new List <ITab>(); foreach (Type current in thingDef.inspectorTabs) { thingDef.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(current)); } } if (!thingDef.inspectorTabsResolved.OfType <ITab_Pawn_AutoEquip>().Any()) { thingDef.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(typeof(ITab_Pawn_AutoEquip))); Debug.Log("Add Tab"); } for (int i = thingDef.inspectorTabsResolved.Count - 1; i >= 0; i--) { if (thingDef.inspectorTabsResolved[i].GetType() == typeof(ITab_Pawn_Gear)) { thingDef.inspectorTabsResolved.RemoveAt(i); } } for (int i = thingDef.inspectorTabs.Count - 1; i >= 0; i--) { if (thingDef.inspectorTabs[i] == typeof(ITab_Pawn_Gear)) { thingDef.inspectorTabs.RemoveAt(i); } } }
public override void Inject() { // inject ITab into all humanlikes foreach (ThingDef def in DefDatabase <ThingDef> .AllDefsListForReading.Where(td => td.category == ThingCategory.Pawn && td.race.Humanlike)) { if (def.inspectorTabs == null || def.inspectorTabs.Count == 0) { def.inspectorTabs = new List <Type>(); def.inspectorTabsResolved = new List <ITab>(); } if (def.inspectorTabs.Contains(typeof(ITab_Pawn_Outfitter))) { return; } def.inspectorTabs.Add(typeof(ITab_Pawn_Outfitter)); def.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(typeof(ITab_Pawn_Outfitter))); } // have EdB reload the tabs // There appears to be a race condition between EdB tab replacements and our extra tab. If EdB goes first, ours does not get shown until EdB refreshes tabs. // TODO: Figure out how to get to the ComponentTabReplacement to call the reset there foreach (IPreference preference in Preferences.Instance.Groups.SelectMany(group => group.Preferences)) { if (preference is PreferenceTabArt) { // insanely silly on off toggle just to get EdB to set the dirty toggle and reload ITabs so our custom one should always get loaded. ((PreferenceTabArt)preference).Value = !((PreferenceTabArt)preference).Value; ((PreferenceTabArt)preference).Value = !((PreferenceTabArt)preference).Value; break; } } }
public ContursManager(IList <IContur> conturs, ITabManager tabManager) { _conturs = conturs; _tabManager = tabManager; ReadJson(); RefreshConturs = new Command(ReadJson); }
public MockPluginEnvironment(IResourceStore storage) { _picoContainer = new DefaultPicoContainer(); _mockPicoContainer = new DefaultPicoContainer(_picoContainer); Storage = storage; if (storage != null) { _picoContainer.RegisterComponentInstance(storage); } File.Delete(".\\MockPluginEnvironment.ini"); _settingStore = new Ini.IniFile(".\\MockPluginEnvironment.ini"); DynamicMock actionManagerMock = new DynamicMock(typeof(IActionManager)); actionManagerMock.SetupResult("GetKeyboardShortcut", "", typeof(IAction)); _actionManager = (IActionManager)actionManagerMock.MockInstance; _uiManager = (IUIManager) new DynamicMock(typeof(IUIManager)).MockInstance; _pluginLoader = (IPluginLoader) new DynamicMock(typeof(IPluginLoader)).MockInstance; _resourceBrowser = (IResourceBrowser) new DynamicMock(typeof(IResourceBrowser)).MockInstance; _tabManager = new MockTabManager(); _resourceAP = new MockAsyncProcessor(); _networkAP = new MockAsyncProcessor(); _uiAP = new MockAsyncProcessor(); DynamicMock resourceIconManagerMock = new DynamicMock(typeof(IResourceIconManager)); resourceIconManagerMock.SetupResult("IconColorDepth", ColorDepth.Depth8Bit); resourceIconManagerMock.SetupResult("GetIconIndex", 0, typeof(IResource)); _resourceIconManager = (IResourceIconManager)resourceIconManagerMock.MockInstance; _notificationManager = (INotificationManager) new DynamicMock(typeof(INotificationManager)).MockInstance; _textIndexManager = (ITextIndexManager) new DynamicMock(typeof(ITextIndexManager)).MockInstance; _messageFormatter = (IMessageFormatter) new DynamicMock(typeof(IMessageFormatter)).MockInstance; _displayColumnManager = (IDisplayColumnManager) new DynamicMock(typeof(IDisplayColumnManager)).MockInstance; // DynamicMock filterManagerMock = new DynamicMock( typeof(IFilterRegistry) ); DynamicMock filterEngineMock = new DynamicMock(typeof(IFilterEngine)); filterEngineMock.SetupResult("ExecRules", true, typeof(string), typeof(IResource)); DynamicMock filterManagerMock = new DynamicMock(typeof(IFilterRegistry)); _filterRegistry = (IFilterRegistry)filterManagerMock.MockInstance; _rcManager = (IRemoteControlManager) new DynamicMock(typeof(IRemoteControlManager)).MockInstance; _trayIconManager = (ITrayIconManager) new DynamicMock(typeof(ITrayIconManager)).MockInstance; _formattingRuleManager = (IFormattingRuleManager) new DynamicMock(typeof(IFormattingRuleManager)).MockInstance; _expirationRuleManager = (IExpirationRuleManager) new DynamicMock(typeof(IExpirationRuleManager)).MockInstance; _filteringFormsManager = (IFilteringFormsManager) new DynamicMock(typeof(IFilteringFormsManager)).MockInstance; _searchQueryExtensions = (ISearchQueryExtensions) new DynamicMock(typeof(ISearchQueryExtensions)).MockInstance; _filterEngine = (IFilterEngine) new DynamicMock(typeof(IFilterEngine)).MockInstance; theInstance = this; }
/// <summary> /// Adds a shortcut to the specified resource to the shortcut bar. /// </summary> public void AddShortcutToResource(IResource newShortcut) { ITabManager tabManager = Core.TabManager; IResource activeWorkspace = Core.WorkspaceManager.ActiveWorkspace; IResourceList shortcutTargets = newShortcut.GetLinksOfType("Shortcut", ShortcutProps.Target); if (newShortcut.Type == "SearchView") { foreach (IResource res in shortcutTargets) { if (res.GetStringProp(ShortcutProps.TabID) == tabManager.CurrentTabId && res.GetLinkProp(ShortcutProps.Workspace) == activeWorkspace) { return; } } } else { if (shortcutTargets.Count > 0) { return; } } ResourceProxy proxy = ResourceProxy.BeginNewResource("Shortcut"); proxy.SetProp(ShortcutProps.Order, _maxOrder + 1); proxy.AddLink(ShortcutProps.Target, newShortcut); if (activeWorkspace != null) { proxy.AddLink(ShortcutProps.Workspace, activeWorkspace); } if (newShortcut.Type == "SearchView") { proxy.SetProp(ShortcutProps.TabID, tabManager.CurrentTabId); string wsName = ""; if (activeWorkspace != null) { wsName = " in " + activeWorkspace.GetStringProp(Core.Props.Name); } proxy.SetProp(Core.Props.Name, tabManager.CurrentTab.Name + wsName + ": " + newShortcut.DisplayName); } else if (newShortcut.DisplayName.Length > 20) { proxy.SetProp(Core.Props.Name, newShortcut.DisplayName.Substring(0, 20) + "..."); } proxy.EndUpdate(); RebuildShortcutBar(); }
private void InjectTab(ThingDef thingDef) { if (thingDef.inspectorTabsResolved == null) { thingDef.inspectorTabsResolved = new List <ITab>(); foreach (Type current in thingDef.inspectorTabs) { thingDef.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(current)); } } if (!thingDef.inspectorTabsResolved.OfType <ITab_Pawn_Ability>().Any()) { thingDef.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(typeof(ITab_Pawn_Ability))); } }
private void button3_Click(object sender, EventArgs e) { MessageBox.Show("charging..."); ITabManager tabMgr = retailMgr.GetTabManager(); int count = listView1.SelectedItems.Count; if (count == 1) { ListViewItem itemSelected = listView1.SelectedItems[0]; PPCustomerTab ppTab = (PPCustomerTab)itemSelected.Tag; if (ppTab != null) { //tabMgr.ChargeTab(ppTab); } } }
public override bool Inject() { // get reference to lists of itabs var itabs = ThingDefOf.Human.inspectorTabs; var itabsResolved = ThingDefOf.Human.inspectorTabsResolved; /* * #if DEBUG * Log.Message( "Inspector tab types on humans:" ); * foreach ( var tab in itabs ) * { * Log.Message( "\t" + tab.Name ); * } * Log.Message( "Resolved tab instances on humans:" ); * foreach ( var tab in itabsResolved ) * { * Log.Message( "\t" + tab.labelKey.Translate() ); * } #endif */ // replace ITab in the unresolved list var index = itabs.IndexOf(typeof(ITab_Pawn_Gear)); if (index != -1) { itabs.Remove(typeof(ITab_Pawn_Gear)); itabs.Insert(index, typeof(ITab_Inventory)); } // replace resolved ITab, if needed. var oldGearTab = ITabManager.GetSharedInstance(typeof(ITab_Pawn_Gear)); var newGearTab = ITabManager.GetSharedInstance(typeof(ITab_Inventory)); if (!itabsResolved.NullOrEmpty() && itabsResolved.Contains(oldGearTab)) { int resolvedIndex = itabsResolved.IndexOf(oldGearTab); itabsResolved.Insert(resolvedIndex, newGearTab); itabsResolved.Remove(oldGearTab); } return(true); }
public PlayerInitializer(ITabManager tabManager, IProtoMessageSender protoMessageSender) { _tabManager = tabManager; _protoMessageSender = protoMessageSender; }
public ToolWindowManager(ITabManager tabManager) { this.tabManager = tabManager; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); _tabManager = InitializeTabContextSwitch(); }
public override bool Inject() { var thingsToReplaceITabOn = DefDatabase <ThingDef> .AllDefs.Where(thingDef => ( (thingDef.inspectorTabs != null) && (thingDef.inspectorTabs.Contains(typeof(RimWorld.ITab_Pawn_Prisoner))) )).ToList(); foreach (var thingDef in thingsToReplaceITabOn) { thingDef.inspectorTabs.Remove(typeof(RimWorld.ITab_Pawn_Prisoner)); thingDef.inspectorTabs.Add(typeof(ITab_Pawn_Prisoner)); thingDef.inspectorTabs.Add(typeof(ITab_Pawn_Slave)); if (thingDef.inspectorTabsResolved != null) { foreach (var iTab in thingDef.inspectorTabsResolved) { if (iTab is RimWorld.ITab_Pawn_Prisoner) { thingDef.inspectorTabsResolved.Remove(iTab); break; } } thingDef.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(typeof(ITab_Pawn_Prisoner))); thingDef.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(typeof(ITab_Pawn_Slave))); } if (thingDef.comps == null) { thingDef.comps = new List <CompProperties>(); } if (!thingDef.HasComp(typeof(CompSlave))) { var compProperties = new CompProperties(); compProperties.compClass = typeof(CompSlave); thingDef.comps.Add(compProperties); } } // Allow prisoners to have a joy need var RW_Pawn_NeedsTracker_ShouldHaveNeed = typeof(Pawn_NeedsTracker).GetMethod("ShouldHaveNeed", BindingFlags.Instance | BindingFlags.NonPublic); var PI_Pawn_NeedsTracker_ShouldHaveNeed = typeof(_Pawn_NeedsTracker).GetMethod("_ShouldHaveNeed", BindingFlags.Static | BindingFlags.NonPublic); if (!Detours.TryDetourFromTo(RW_Pawn_NeedsTracker_ShouldHaveNeed, PI_Pawn_NeedsTracker_ShouldHaveNeed)) { return(false); } // Disallow removing the collar var RW_Pawn_ApparelTracker_TryDrop = typeof(Pawn_ApparelTracker).GetMethods().First <MethodInfo>((arg) => ( (arg.Name == "TryDrop") && (arg.GetParameters().Count() == 4) )); var PI_Pawn_ApparelTracker_TryDrop = typeof(_Pawn_ApparelTracker).GetMethod("_TryDrop", BindingFlags.Static | BindingFlags.NonPublic); if (!Detours.TryDetourFromTo(RW_Pawn_ApparelTracker_TryDrop, PI_Pawn_ApparelTracker_TryDrop)) { return(false); } return(true); }