Esempio n. 1
0
        public override void Inject()
        {
            FieldInfo field = typeof(Zone_Stockpile).GetField("StorageTab", BindingFlags.Static | BindingFlags.NonPublic);

            field.SetValue(null, tabStorage);

            foreach (ThingDef current in DefDatabase <ThingDef> .AllDefs)
            {
                if (current.inspectorTabsResolved != null)
                {
                    bool flag         = false;
                    ITab tabToReplace = null;
                    foreach (ITab tab in current.inspectorTabsResolved)
                    {
                        if (tab.GetType() == typeof(ITab_Storage))
                        {
                            flag         = true;
                            tabToReplace = tab;
                            break;
                        }
                    }

                    if (flag)
                    {
                        int index = current.inspectorTabsResolved.IndexOf(tabToReplace);
                        current.inspectorTabsResolved.RemoveAt(index);
                        current.inspectorTabsResolved.Insert(index, tabStorage);
                    }
                }
            }
            Log.Message("Injector_StorageSearch : Injected");
        }
Esempio n. 2
0
    public TabInstance Create()
    {
        if (Bookmark.Type == null)
        {
            return(null);
        }

        if (!typeof(ITab).IsAssignableFrom(Bookmark.Type))
        {
            throw new Exception("Bookmark.Type must implement ITab");
        }

        var      call         = new Call();
        Bookmark bookmarkCopy = Bookmark.DeepClone(call, true);         // This will get modified as users navigate

        ITab tab = bookmarkCopy.TabBookmark.Tab;

        if (tab == null)
        {
            tab = (ITab)Activator.CreateInstance(bookmarkCopy.Type);
        }

        if (tab is IReload reloadable)
        {
            reloadable.Reload();
        }

        TabInstance tabInstance = tab.Create();

        tabInstance.Project = Project.Open(bookmarkCopy);
        tabInstance.iTab    = this;
        tabInstance.IsRoot  = true;
        tabInstance.SelectBookmark(bookmarkCopy.TabBookmark);
        return(tabInstance);
    }
Esempio n. 3
0
        private HashSet <IIGameNode> getRootNodes(IIGameScene maxGameScene)
        {
            HashSet <IIGameNode> maxGameNodes = new HashSet <IIGameNode>();

            Func <IIGameNode, IIGameNode> getMaxRootNode = delegate(IIGameNode maxGameNode)
            {
                while (maxGameNode.NodeParent != null)
                {
                    maxGameNode = maxGameNode.NodeParent;
                }
                return(maxGameNode);
            };

            Action <Autodesk.Max.IGameObject.ObjectTypes> addMaxRootNodes = delegate(Autodesk.Max.IGameObject.ObjectTypes type)
            {
                ITab <IIGameNode> maxGameNodesOfType = maxGameScene.GetIGameNodeByType(type);
                if (maxGameNodesOfType != null)
                {
                    TabToList(maxGameNodesOfType).ForEach(maxGameNode =>
                    {
                        var maxRootNode = getMaxRootNode(maxGameNode);
                        maxGameNodes.Add(maxRootNode);
                    });
                }
            };

            addMaxRootNodes(Autodesk.Max.IGameObject.ObjectTypes.Mesh);
            addMaxRootNodes(Autodesk.Max.IGameObject.ObjectTypes.Light);
            addMaxRootNodes(Autodesk.Max.IGameObject.ObjectTypes.Camera);

            return(maxGameNodes);
        }
Esempio n. 4
0
        public bool SaveTab(ITab tab, string TabId)
        {
            if (!string.IsNullOrWhiteSpace(tab.RestoreCommand))
            {
                var Record = this.Os.MainDatabase.EntityContext.SavedTabs.FirstOrDefault(x => x.TabId == TabId);
                if (Record == null)
                {
                    Record = new MainDatabase.Entity.SavedTabs
                    {
                        TabId          = TabId,
                        RestoreCommand = tab.RestoreCommand,
                        Text           = tab.Header.Text
                    };
                    this.Os.MainDatabase.EntityContext.SavedTabs.Add(Record);
                }
                else
                {
                    Record.RestoreCommand = tab.RestoreCommand;
                    Record.Text           = tab.Header.Text;
                }

                this.Os.MainDatabase.EntityContext.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public override void Deleted(ITab <UIntPtr> nodes)
        {
#if DEBUG
            MaxListener.PrintToListener("NodeEventCallback > Deleted");
#endif
            List <BaseTreeNode> deletedNodes = new List <BaseTreeNode>();
            for (int i = 0; i < nodes.Count; i++)
            {
                UIntPtr nodeHandle = nodes[(IntPtr)i];

                List <BaseTreeNode> baseTreeNodes = NodeControl.HandleMap.GetTreeNodesByHandle(nodeHandle);
                foreach (BaseTreeNode baseTreeNode in baseTreeNodes)
                {
                    if (baseTreeNode != null)
                    {
                        deletedNodes.Add(baseTreeNode);
                    }
                }
            }
            try
            {
                ListView.BeginUpdate();
                NodeControl.Destroy.DeleteTreeNodes(deletedNodes);
            }
            catch
            {
                throw new Exception();
            }
            finally
            {
                ListView.EndUpdate();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// This event triggers when a tab is dragged outside the bonds of the tab control panel.
        /// We can use it to create a docking tab control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChromeTabControl_TabDraggedOutsideBonds(object sender, TabDragEventArgs e)
        {
            ITab draggedTab = e.Tab as ITab;

            if (draggedTab is TabClass3)
            {
                return;                                                                        //We don't want out TabClass3 to form new windows, so we stop it here.
            }
            DockingWindow win = _openWindows.FirstOrDefault(x => x.DataContext == draggedTab); //check if it's already open

            if (win == null)                                                                   //If not, create a new one
            {
                win                  = new DockingWindow();
                win.Title            = draggedTab.TabName;
                win.DataContext      = draggedTab;
                win.Closed          += win_Closed;
                win.Loaded          += win_Loaded;
                win.LocationChanged += win_LocationChanged;
                win.Tag              = e.CursorPosition;
                win.Show();
            }
            else
            {
                Debug.WriteLine(DateTime.Now.ToShortTimeString() + " got window");
                MoveWindow(win, e.CursorPosition);
            }
            this._openWindows.Add(win);
            Debug.WriteLine(e.CursorPosition);
        }
Esempio n. 7
0
 protected async Task OnInternalEachTabRenderCompleted(ITab tab)
 {
     //if (OnEachTabRenderCompleted.HasDelegate)
     //{
     //    await OnEachTabRenderCompleted.InvokeAsync(tab);
     //}
 }
Esempio n. 8
0
        private static void PostFillTab(ITab __instance, ref object[] __state)
        {
            if (MP.IsInMultiplayer && (bool)__state[0])
            {
                MP.WatchEnd();

                // Since we got non-null value in prefix, assume same here
                var soul          = pawnSoulITabSoulToShowGetter.Invoke(__instance, Array.Empty <object>());
                var favourTracker = compSoulFavourTrackerField(soul);

                var previousFavourList = (float[])__state[1];
                var favoursList        = soulFavourTrackerFavoursField(favourTracker);

                // Check for changes, revert them (if any) and change them in synced method
                for (var i = 0; i < favoursList.Count; i++)
                {
                    var newValue = favourProgressFavourValueField(favoursList[i]);
                    var oldValue = previousFavourList[i];

                    if (newValue != oldValue)
                    {
                        favourProgressFavourValueField(favoursList[i]) = oldValue;
                        SyncFavourValue((ThingComp)soul, i, newValue);
                        // We could break here, but let's just keep going in case there's more than one changed
                        // There shouldn't be more than a single difference, but let's be safe
                    }
                }
            }
        }
 public void AddTab(ITab tab)
 {
     if (ActiveTab == null)
     {
         SetActivateTab(tab);
     }
 }
 public void ActivetFirstTab(ITab tab)
 {
     if (ActiveTab == null)
     {
         SetActiveTab(tab);
     }
 }
Esempio n. 11
0
      public override void Added(ITab<UIntPtr> nodes)
      {
         IEnumerable<NodeLayerProperty> layerProps = Enum.GetValues(typeof(NodeLayerProperty))
                                                         .Cast<NodeLayerProperty>();

         foreach (IINode node in nodes.NodeKeysToINodeList())
         {
            IINodeLayerProperties nodeLayerProps = node.GetInterface(MaxInterfaces.NodeLayerProperties) as IINodeLayerProperties;
            if (nodeLayerProps == null)
               continue;

            String layerName = nodeLayerProps.Layer.Name;
            IILayer layer = MaxInterfaces.IILayerManager.GetLayer(ref layerName);

            if (layer == null)
               continue;

            foreach (NodeLayerProperty prop in layerProps)
            {
               Boolean byLayer = GetAutoInherit(layer, prop);
               if (byLayer)
                  setNodeInheritProperty(node, prop, true);
            }
         }
      }
Esempio n. 12
0
    // How to set the main Content
    public TabInstance AddTab(ITab tab)
    {
        TabInstance tabInstance = tab.Create();

        tabInstance.Model.Name = "Start";
        tabInstance.iTab       = tab;
        tabInstance.Project    = Project;
        if (LoadBookmarkUri != null)
        {
            // Wait until Bookmarks tab has been created
            Dispatcher.UIThread.Post(() => ImportBookmark(new Call(), LoadBookmarkUri, false), DispatcherPriority.SystemIdle);
        }
        else if (LoadBookmark != null)
        {
            tabInstance.TabBookmark = LoadBookmark.TabBookmark;
        }
        else if (Project.UserSettings.AutoLoad)         // did we load successfully last time?
        {
            tabInstance.LoadDefaultBookmark();
        }

        TabView = new TabView(tabInstance);
        TabView.Load();

        //scrollViewer.Content = tabView;
        ContentGrid.Children.Add(TabView);

        return(tabInstance);
    }
 public void RemoveTab(ITab tab)
 {
     if (ActiveTab == tab)
     {
         SetActivateTab(null);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Returns a tab page of a certain kind
        /// </summary>
        /// <param name="type">The type of tab (browser or favs)</param>
        /// <param name="identifier">the unique key</param>
        /// <returns></returns>
        public ITab Get(TabTypes type, string identifier)
        {
            ITab tab = null;

            if ((tab = tabs[identifier]) == null)
            {
                switch (type)
                {
                case TabTypes.Browser:
                    return(CreateBrowser(identifier));

                case TabTypes.Favorites:
                    return(CreateFavorites("Favorites"));

                default:
                    return(null);
                }
            }
            else
            {
                if (OnShowTab != null)
                {
                    OnShowTab(tab);
                }
                return(tab);
            }
        }
Esempio n. 15
0
        public void Remove(int index)
        {
            if (tabs.Count < current + 1)
            {
                throw new InvalidOperationException(outOfBoundsRemove);
            }
            ITab x     = tabs[index];
            int  width = x.Width;

            this.realWidth -= x.TrueWidth;

            // Clean up parent's collection and our collection
            parent.SuspendLayout();
            parent.RemoveTab((System.Windows.Forms.Control)x);
            tabs.Remove(x);
            tabs.ForEach(t => t.Left -= width);

            removeHelperForCounters(index, width);
            MoveTo(current); resize();

            // ITab's lifetime:
            // It should die out after this event call unless
            // an event help stores it, which is a Bad Idea.
            Removed(x);
            parent.ResumeLayout();
        }
Esempio n. 16
0
        public async Task SetActivateTabAsync(ITab tab)
        {
            if (OnActiveTabChangingAsync != null)
            {
                var allowSwitching = await OnActiveTabChangingAsync(tab);

                if (!allowSwitching)
                {
                    return;
                }
            }
            if (ActiveTab != null && ActiveTab.Name == tab.Name)
            {
                return;
            }
            ActiveTabName = tab.Name;
            var eventArgs = new BChangeEventArgs <ITab>();

            eventArgs.OldValue = ActiveTab;
            eventArgs.NewValue = tab;
            ActiveTab          = tab;
            StateHasChanged();
            if (OnActiveTabChanged.HasDelegate)
            {
                await OnActiveTabChanged.InvokeAsync(eventArgs);
            }
        }
Esempio n. 17
0
        public override void Execute()
        {
            ITab fileTabViewModel = tabService.RequestDefaultTab();

            fileTabViewModel.SetFile(Path.Combine(Folders.UserFolder, "key_bindings.json"));
            shell.Value.OpenTab(fileTabViewModel);
        }
Esempio n. 18
0
        private void pluginServer_PointedTabChanged(object sender, PluginEventArgs e)
        {
            if (this.timer == null)
            {
                this.timer          = new Timer();
                this.timer.Interval = mouseHoverTime;
                this.timer.Tick    += new EventHandler(timer_Tick);
            }

            this.timer.Enabled = false;

            //var tab = this.pluginServer.HitTest( Control.MousePosition );
            // this.pluginServer.GetTabs();
            var tabs = this.pluginServer.GetTabs();

            if (-1 < e.Index && e.Index < tabs.Length)
            {
                this.previousTab   = tabs[e.Index];
                this.timer.Enabled = true;
            }
            else
            {
                this.previousTab = null;
            }
        }
Esempio n. 19
0
        public static void RegisterTab(ITab tab, Type userControl)
        {
            var uc = (UserControl)Activator.CreateInstance(userControl);

            tab.SetContent(uc);
            TabsDic.Add(tab, uc);
        }
Esempio n. 20
0
 public Form_Browser(ITab newTab, Context PluginContext)
 {
     InitializeComponent();
     this.newTab        = newTab;
     this.PluginContext = PluginContext;
     this.webPage       = new WebPage(PluginContext);
 }
Esempio n. 21
0
        private async Task AcitveTabOnRenderCompletedAsync(ITab arg)
        {
            arg.OnRenderCompletedAsync -= AcitveTabOnRenderCompletedAsync;

            var dom   = arg.Element.Dom(JSRuntime);
            var width = await dom.GetClientWidthAsync();

            var paddingLeft = await dom.Style.GetPaddingLeftAsync();

            var offsetLeft = await dom.GetOffsetLeftAsync();

            var padding       = paddingLeft + (await dom.Style.GetPaddingRightAsync());
            var barWidth      = width - padding;
            var barOffsetLeft = offsetLeft + paddingLeft;

            if (BarWidth == barWidth && barOffsetLeft == BarOffsetLeft)
            {
                if (OnTabRenderComplete.HasDelegate)
                {
                    await OnTabRenderComplete.InvokeAsync(arg);
                }
                return;
            }
            BarWidth      = barWidth;
            BarOffsetLeft = barOffsetLeft;
        }
Esempio n. 22
0
        public override void FreezeChanged(ITab <UIntPtr> nodes)
        {
#if DEBUG
            MaxListener.PrintToListener("NodeEventCallback > FreezeChanged");
#endif
            RefreshNodes(nodes);
        }
Esempio n. 23
0
        public static bool HasNode(this IILayer layer, IINode node, bool checkInChild = true)
        {
#if MAX2020
            ITab <IINode> nodes = Loader.Global.INodeTab.Create();
#else
            ITab <IINode> nodes = Loader.Global.INodeTabNS.Create();
#endif
            IILayerProperties layerProperties = Loader.IIFPLayerManager.GetLayer(layer.Name);
            layerProperties.Nodes(nodes);

            foreach (IINode n in Tools.ITabToIEnumerable(nodes))
            {
                if (node.Handle == n.Handle)
                {
                    return(true);
                }
            }

            for (int i = 0; i < layer.NumOfChildLayers; i++)
            {
                IILayer child = layer.GetChildLayer(i);
                if (child.HasNode(node, checkInChild))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 24
0
        private static void PreFillTab(ITab __instance, ref object[] __state)
        {
            if (MP.IsInMultiplayer)
            {
                __state = new object[2];

                var soul = pawnSoulITabSoulToShowGetter.Invoke(__instance, Array.Empty <object>());

                if (soul != null)
                {
                    MP.WatchBegin();
                    var prayerTracker = compSoulPrayerTrackerField(soul);
                    prayerTrackerAllowPrayingSync.Watch(prayerTracker);
                    prayerTrackerShowPrayerSync.Watch(prayerTracker);
                    __state[0] = true;


                    var favourTracker = compSoulFavourTrackerField(soul);
                    var favoursList   = soulFavourTrackerFavoursField(favourTracker);

                    var favorValues = new float[favoursList.Count];
                    for (var i = 0; i < favoursList.Count; i++)
                    {
                        favorValues[i] = favourProgressFavourValueField(favoursList[i]);
                    }

                    __state[1] = favorValues;
                }
                else
                {
                    __state[0] = false;
                }
            }
        }
        public override void Execute()
        {
            ITab fileTabViewModel = tabService.RequestDefaultTab();

            fileTabViewModel.SetFile(Path.Combine(Folders.ProgramFolder, "config.json"));
            shell.Value.OpenTab(fileTabViewModel);
        }
Esempio n. 26
0
        public override void DisplayPropertiesChanged(ITab <UIntPtr> nodes)
        {
#if DEBUG
            MaxListener.PrintToListener("NodeEventCallback > DisplayPropertiesChanged");
#endif
            RefreshNodes(nodes);
        }
Esempio n. 27
0
        private void OnNodeDeleted(IntPtr Obj, IntPtr Info)
        {
            // marshal the info ptr to notify info
            INotifyInfo notifyInfo = AssemblyFunctions.GlobalInterface.NotifyInfo.Marshal(Info);

            if (notifyInfo == null)
            {
                return;
            }

            // check if the params are a list of nodes
            // ITab is the list handling inside max sdk
            ITab <IINode> nodes = notifyInfo.CallParam as ITab <IINode>;

            if (nodes != null)
            {
                NodeManager.SceneNodesDeleted(nodes);
                return;
            }

            // check if the params are one iinode
            IINode node = notifyInfo.CallParam as IINode;

            if (node != null)
            {
                NodeManager.SceneNodeDeleted(node);
            }
        }
Esempio n. 28
0
        public void MoveTo(ITab tab)
        {
            int index = tabs.IndexOf(tab);

            c(() => { current = index; parent.GrabFocus(); });
            this.Moved(tab);
        }
Esempio n. 29
0
        public ITab Add(string label)
        {
            if (null == label)
            {
                label = defaultLabel;
            }
            if (tabs.Count > 0)
            {
                tabs[current].BecomeOld();
            }

            // Math trick. This is before we add it, so it's
            // lastIndex + 1, or Count.
            current = tabs.Count;

            ITab tab = this.parent.CreateTab(label);

            this.NewTab(tab);

            this.right     += tab.Width;
            this.realWidth += tab.TrueWidth;

            parent.GrabFocus();
            resize();

            return(tab);
        }
Esempio n. 30
0
 protected async Task <bool> OnInternalActiveTabChangingAsync(ITab tab)
 {
     if (OnActiveTabChangingAsync == null)
     {
         return(await Task.FromResult(true));
     }
     return(await OnActiveTabChangingAsync(tab));
 }
Esempio n. 31
0
 public void SetActiveTab(ITab tab)
 {
     if (ActiveTab != tab)
     {
         ActiveTab = tab;
         StateHasChanged();
     }
 }
Esempio n. 32
0
 public override void SelectionChanged(ITab<UIntPtr> nodes)
 {
    if (GroupHelpers.CloseUnselectedGroupHeads())
    {
       IInterface core = MaxInterfaces.COREInterface;
       core.RedrawViews(core.Time, RedrawFlags.Normal, null);
    }
 }
Esempio n. 33
0
 private void fillObjectsList(ITab<IIGameNode> list, string scriptName)
 {
     object[] names = new object[list.Count];
     for (int i = 0; i < list.Count; i++)
     {
         var indexer = new IntPtr(i);
         var node = list[indexer];
         names[i] = node.MaxNode.Name;
     }
     _document.InvokeScript(scriptName, names);
 }
Esempio n. 34
0
 private static void AddCommandLineToTab(ITab tab)
 {
   IFolderView FolderView = tab as IFolderView;
   if (FolderView != null)
   {
     CommandLinePanel CmdLinePanel = new CommandLinePanel();
     CmdLinePanel.MaxCommandLength = _MaxCommandLength;
     CmdLinePanel.HistoryDepth = _HistoryDepth;
     tab.DockControl(DockStyle.Bottom, CmdLinePanel);
     FolderView.CurrentFolderChanged += (sender2, e2) => CmdLinePanel.CurrentFolder = FolderView.CurrentFolder;
   }
 }
Esempio n. 35
0
        private void fillSoundsList(ITab<IIGameNode> list, string scriptName)
        {
            object[] names = new object[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                var indexer = new IntPtr(i);
                var node = list[indexer].MaxNode;
                string soundFile = "";

                soundFile = Tools.GetStringProperty(node, "babylonjs_sound_filename", soundFile);
                names[i] = Path.GetFileName(soundFile);
            }
            _document.InvokeScript(scriptName, names);
        }
Esempio n. 36
0
 private void DoLog(ITab<UIntPtr> nodes, string name)
 {
     string str = DateTime.Now.ToShortTimeString() + "CallbackEvent: " + name + " .. ";
     str += nodes.Count + " node(s) -- ";
     for (int i = 0; i < nodes.Count; i++)
     {
         using (var n = Global.NodeEventNamespace.GetNodeByKey(nodes[(IntPtr)i]))
         {
             if (n == null) throw new ArgumentNullException("nodes");
             str += n.Name+"  ";
         }
     }
     listView.Items.Add(str);
     listView.ScrollIntoView(listView.Items[listView.Items.Count - 1]);
 }
Esempio n. 37
0
 public override void ModelStructured(ITab<UIntPtr> nodes)
 {
    foreach (IINode node in nodes.NodeKeysToINodeList())
    {
       TreeNode tn = this.TreeMode.GetFirstTreeNode(node);
       if (tn != null)
          tn.Invalidate();
    }
 }
Esempio n. 38
0
 /// <summary>
 /// Inserts an <paramref name="item"/> to the <paramref name="category"/> tab.
 /// </summary>
 /// <param name="item">An <see cref="Item"/> to paste.</param>
 /// <param name="tab">A <see cref="Tab"/> to add an item.</param>
 /// <remarks>Invoked by the 'Paste' menu item.</remarks>
 protected virtual void OnPasteItem(Item item, ITab tab)
 {
     if (item == null) {
         throw new ArgumentNullException("item");
     }
     if (tab == null) {
         throw new ArgumentNullException("category");
     }
     if (item.Owner != null) {
         if (item.Owner == tab) {
             return;
         }
         item.Owner.Items.Remove(item);
     }
     tab.Items.Add(item);
 }
Esempio n. 39
0
 public override void DisplayPropertiesChanged(ITab<UIntPtr> nodes)
 {
     string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
     DoLog(nodes, name);
 }
Esempio n. 40
0
 public void OnMenuItemClick(MenuType menuType, string menuText, ITab tab) {
     ShowMemoForm(tab.Address.Path, true);
 }
Esempio n. 41
0
 /// <summary>
 /// Creates a default unique category name using the <paramref name="baseName"/>..
 /// </summary>
 protected static string GetUnusedCategoryName(ITab tab, string baseName)
 {
     string category = baseName;
     for (int i = 1;; i++) {
         category = string.Format("{0}{1}", baseName, i);
         if (tab.Categories[category] == null) {
             break;
         }
     }
     return category;
 }
Esempio n. 42
0
      public override void MaterialStructured(ITab<UIntPtr> nodes)
      {
         foreach (IINode node in nodes.NodeKeysToINodeList())
         {
            TreeNode tn = this.TreeMode.GetFirstTreeNode(node);
            TreeNode matTn = this.TreeMode.GetFirstTreeNode(node.Mtl);

            if (tn == null || matTn == null)
               continue;

            matTn.Nodes.Add(tn);
            this.Tree.AddToSortQueue(tn);
         }

         this.Tree.StartTimedSort(true);
      }
Esempio n. 43
0
 public override void RenderPropertiesChanged(ITab<UIntPtr> nodes)
 {
    Boolean sort = NodeSorter.RequiresSort(this.NodeSorter, NodeProperties.RenderProperties);
    this.TreeMode.InvalidateTreeNodes(nodes, sort);
 }
Esempio n. 44
0
 public override void WireColorChanged(ITab<UIntPtr> nodes)
 {
    Boolean sort = NodeSorter.RequiresSort(this.NodeSorter, NodeProperty.WireColor);
    this.TreeMode.InvalidateTreeNodes(nodes, sort);
 }
Esempio n. 45
0
 public override void ModelStructured(ITab<UIntPtr> nodes)
 {
     string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
     DoLog(nodes, name);
 }
		private static ISearchResult ConvertTabToResult(IWindowSearchResult item, ITab tab)
		{
			return new TabSearchResult(item, tab, () => new BasicListEntry());
		}
Esempio n. 47
0
 public override void TopologyChanged(ITab<UIntPtr> nodes)
 {
     string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
     DoLog(nodes, name);
 }
		public TabSearchResult(IWindowSearchResult item, ITab tab, Func<UserControl> viewCtor)
			: base(viewCtor)
		{
			_item = item;
			_tab = tab;
		}
Esempio n. 49
0
      public override void LayerChanged(ITab<UIntPtr> nodes)
      {
         foreach (IINode node in nodes.NodeKeysToINodeList())
         {
            TreeNode tn = this.TreeMode.GetFirstTreeNode(node);
            if (tn == null)
               return;

            TreeNode layerTn = this.layerMode.GetParentTreeNode(node);
            if (layerTn == null)
               continue;

            layerTn.Nodes.Add(tn);
            this.Tree.AddToSortQueue(layerTn.Nodes);
         }
         this.Tree.StartTimedSort(true);
      }
Esempio n. 50
0
        private void ProcessTabChanges(TabChangedEventArgs tabChangedEventArgs, TabHeader tabHeader, ITab tab)
        {
            if (tabChangedEventArgs.ClearChanges)
            {
                tab.TabChanges.Clear();
            }
            else
            {
                if (tabChangedEventArgs.Changed)
                {
                    if (!tab.TabChanges.Contains(tabChangedEventArgs.PropertyName))
                    {
                        tab.TabChanges.Add(tabChangedEventArgs.PropertyName);
                    }
                }
                else
                {
                    if (tab.TabChanges.Contains(tabChangedEventArgs.PropertyName))
                    {
                        tab.TabChanges.Remove(tabChangedEventArgs.PropertyName);
                    }
                }
            }

            if (tab.TabChanges.Count > 0)
            {
                if (!tabHeader.headerLabel.Content.ToString().Contains("*"))
                {
                    tabHeader.headerLabel.Content = String.Format("* {0}", tabHeader.headerLabel.Content);
                    tab.RequiresSave = true;
                }
            }
            else
            {
                tabHeader.headerLabel.Content = tabHeader.headerLabel.Content.ToString().Replace("* ", "");
                tab.RequiresSave = false;
            }
        }
Esempio n. 51
0
      public override void LinkChanged(ITab<UIntPtr> nodes)
      {
         foreach (IINode node in nodes.NodeKeysToINodeList())
         {
            TreeNode tn = this.TreeMode.GetFirstTreeNode(node);
            if (tn != null)
            {
               TreeNodeCollection newParentCol = null;
               if (node.ParentNode == null || node.ParentNode.IsRootNode)
                  newParentCol = this.Tree.Nodes;
               else
               {
                  TreeNode newParentTn = this.TreeMode.GetFirstTreeNode(node.ParentNode);
                  if (newParentTn != null)
                     newParentCol = newParentTn.Nodes;
                  //TODO add logic for filtered / not yet added node.
               }

               if (newParentCol != null)
               {
                  newParentCol.Add(tn);
                  this.Tree.AddToSortQueue(newParentCol);
               }
            }
         }
         this.Tree.StartTimedSort(true);
      }
Esempio n. 52
0
 /// <summary>
 /// Creates a default unique category name.
 /// </summary>
 protected static string GetUnusedCategoryName(ITab tab)
 {
     return GetUnusedCategoryName(tab, Resources.ToolboxTabDefaultName);
 }
Esempio n. 53
0
 public override void HierarchyOtherEvent(ITab<UIntPtr> nodes)
 {
     string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
     DoLog(nodes, name);
 }
Esempio n. 54
0
      public override void GroupChanged(ITab<UIntPtr> nodes)
      {
         if (this.layerMode.showGroupContents)
            return;

         foreach (IINode node in nodes.NodeKeysToINodeList())
         {
            if (node.IsGroupMember)
            {
               this.layerMode.RemoveNode(node);
            }
            else
            {
               TreeNode layerTn = this.layerMode.GetParentTreeNode(node);
               if (layerTn == null)
                  continue;

               this.layerMode.AddNode(node, layerTn.Nodes);
               this.Tree.AddToSortQueue(layerTn.Nodes);
            }
         }

         this.Tree.StartTimedSort(true);
      }
Esempio n. 55
0
 public void OnMenuItemClick(MenuType menuType, string menuText, ITab tab) {
 }
        //private void AddTab(ITab tab, string tabName)
        //{
        //    using (new AutoWaitCursor())
        //    {
        //        if (ItemCollection.Count != 0)
        //        {
        //            bool existFlag = false;
        //            for (int i = 0; i < ItemCollection.Count; i++)
        //            {
        //                if (ItemCollection[i].TabName == "改库")
        //                {
        //                    existFlag = false;
        //                }
        //                else if (ItemCollection[i].TabName == tabName)
        //                {
        //                    existFlag = true;
        //                    break;
        //                }
        //            }
        //            if (!existFlag)
        //            {
        //                this.ItemCollection.Add(tab);
        //            }
        //        }
        //        else
        //        {
        //            this.ItemCollection.Add(tab);
        //        }
        //        this.SelectedTab = tab;
        //    }
        //}

        /// <summary>
        /// 关闭Tab
        /// </summary>
        /// <param name="ITab"></param>
        private void CloseTabCommandExcute(ITab vm)
        {
            if (vm.TabName == "建库")
            {
                if (!BuildLibraryViewModel.isFinishButtonBeClicked)
                {
                    this.ItemCollection.Remove(vm);
                }
                else
                {
                    var DialogResult = MessageBoxPlus.Show(App.Current.MainWindow, "是否保存?\r\n点击“是”保存,点击“否”关闭,点击“取消”返回继续操作。", "提示", System.Windows.MessageBoxButton.YesNoCancel, System.Windows.MessageBoxImage.Question);
                    if (DialogResult == MessageBoxResult.Yes)
                    {
                        foreach (BuildLibraryViewModel tab in ItemCollection.OfType<BuildLibraryViewModel>())
                        {
                            if (tab.CreateNewFileCommand.CanExecute())
                            {
                                tab.CreateNewFileCommand.Execute();
                            }
                            break;
                        }
                    }
                    else if (DialogResult == MessageBoxResult.No)
                    {
                        this.ItemCollection.Remove(vm);
                        string DataBaseFile = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "MyData.db");
                        using (SQLiteConnection conn = new SQLiteConnection(string.Format("data source={0}", DataBaseFile)))
                        {
                            using (SQLiteCommand cmd = new SQLiteCommand())
                            {
                                cmd.Connection = conn;
                                conn.Open();
                                SQLiteHelper sh = new SQLiteHelper(cmd);
                                sh.ExecuteScalar("delete from QuestionInfo");
                                sh.ExecuteScalar("update sqlite_sequence SET seq = 0 where name ='QuestionInfo'");
                                conn.Close();
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else if (vm.TabName == "录入")
            {
                ListBoxSelectedIndex.Instance.DicQIndex.Clear();
                ListBoxSelectedIndex.Instance.KeyValue = 0;
                foreach (DataEntryFormViewModel tab in ItemCollection.OfType<DataEntryFormViewModel>())
                {
                    foreach (DataEntryViewModel devm in tab.DataEntryViewModels.OfType<DataEntryViewModel>())
                    {
                        CommandProxy.SaveAllEntryDataCommand.UnregisterCommand(devm.SaveCommand);
                        CommandProxy.MoveToFirstRecordCommand.UnregisterCommand(devm.FirstRecordCommand);
                        CommandProxy.MoveToLastRecordCommand.UnregisterCommand(devm.LastRecordCommand);
                        CommandProxy.MoveToPreviousRecordCommand.UnregisterCommand(devm.PreviousRecordCommand);
                        CommandProxy.MoveToNextRecordCommand.UnregisterCommand(devm.NextRecordCommand);
                        CommandProxy.DeleteAllRecordCommand.UnregisterCommand(devm.DeleteRecordCommand);
                        CommandProxy.SearchAllRecordCommand.UnregisterCommand(devm.SearchRecordCommand);
                        EventAggregatorRepository.Instance.eventAggregator.GetEvent<GetRecordNumPubEvent>().Unsubscribe(devm.RecieveRecordNumber);
                    }
                }
                this.ItemCollection.Remove(vm);
            }
            else if (vm.TabName == "合库")
            {
                bool isBusy = false;
                foreach (MergeLibraryViewModel tab in ItemCollection.OfType<MergeLibraryViewModel>())
                {
                    if (!tab.IsEnabled)
                    {
                        MessageBoxPlus.Show(App.Current.MainWindow, "正在合并中,请稍后尝试\r\n2秒后自动关闭", "提示", MessageBoxButton.OK, MessageBoxImage.Information, 2000);
                        isBusy = true;
                        return;
                    }
                }
                if (isBusy == false)
                {
                    this.ItemCollection.Remove(vm);
                }
            }
            else if (vm.TabName == "导出")
            {
                bool isBusy = false;
                foreach (ExportDataViewModel tab in ItemCollection.OfType<ExportDataViewModel>())
                {
                    if (!tab.IsEnabled)
                    {
                        MessageBoxPlus.Show(App.Current.MainWindow, "正在导出中,请稍后尝试\r\n2秒后自动关闭", "提示", MessageBoxButton.OK, MessageBoxImage.Information, 2000);
                        isBusy = true;
                        return;
                    }
                }
                if (isBusy == false)
                {
                    this.ItemCollection.Remove(vm);
                }
            }
            else
            {
                this.ItemCollection.Remove(vm);
            }
            _status.ShowStatus("就绪");
        }
Esempio n. 57
0
 public override void Deleted(ITab<UIntPtr> nodes)
 {
    foreach (IINode node in nodes.NodeKeysToINodeList())
       this.TreeMode.RemoveNode(node);
 }
 //To close a tab, we simply remove the viewmodel from the source collection.
 private void CloseTabCommandAction(ITab vm)
 {
     this.ItemCollection.Remove(vm);
 }
Esempio n. 59
0
        public void OnMenuItemClick(MenuType menuType, string menuText, ITab tab) {
            // user clicked registered menu.

            if(menuText == "SampleSplitButton Menu test") {
                if(menuType == MenuType.Tab) {
                    MessageBox.Show(tab.Address.Path);
                }
                else if(menuType == MenuType.Bar) {
                    pluginServer.ExecuteCommand(Commands.OpenTabBarOptionDialog, null);
                }
            }
        }
Esempio n. 60
0
 public override void NameChanged(ITab<UIntPtr> nodes)
 {
    Boolean sort = NodeSorter.RequiresSort(this.NodeSorter, typeof(AlphabeticalSorter));
    this.TreeMode.InvalidateTreeNodes(nodes, sort);
 }