private void createMainMenu()
        {
            List <MenuItem> showDataTimeMenuItems       = new List <MenuItem>();
            List <MenuItem> VersionAndCapitalsMenuItems = new List <MenuItem>();

            MenuItem showTime = new LeafItem("Show Time", new TestMenuActions.ShowTime());
            MenuItem showDate = new LeafItem("Show Date", new TestMenuActions.ShowDate());


            MenuItem countCapitals = new LeafItem("Count Capitals", new TestMenuActions.CountCapitals());
            MenuItem showVersion   = new LeafItem("Show Version", new TestMenuActions.ShowVersion());


            showDataTimeMenuItems.Add(showTime);
            showDataTimeMenuItems.Add(showDate);

            VersionAndCapitalsMenuItems.Add(countCapitals);
            VersionAndCapitalsMenuItems.Add(showVersion);

            MenuItem showDateOrTime     = new NodeItem("Show Date/Time", showDataTimeMenuItems);
            MenuItem VersionAndCapitals = new NodeItem("Version and capitals", VersionAndCapitalsMenuItems);

            m_MainMenu.AddMenuItem(showDateOrTime);
            m_MainMenu.AddMenuItem(VersionAndCapitals);
        }
Esempio n. 2
0
        /// <summary>
        /// Running and return temp cached result table for now.
        /// To do: Just return result table name, invoke search later when user calls RunSearch()
        /// </summary>
        public string AddQueryItem(IQueryItem item)
        {
            if (_logger == null)
            {
                _logger = new SearchLogger();
            }
            _logger.AddQueryItemCalled();

            _queryNodes.Add(item.NodeId, item);

            LeafItem qi = item as LeafItem;

            if (qi == null)
            {
                return(string.Empty);
            }

            MapTableFieldName(qi);

            if (_results.Count < 1)
            {
                QueryResult result = new QueryResult();
                result.SourceTable = qi.TableName;
                _resultMap.Add(result.ResultTable, result);
                _results.Add(result);
            }

            return(_results[0].ResultTable);
        }
Esempio n. 3
0
        /// <summary>
        /// Map table name to a view (for combined index)
        /// </summary>
        private void MapTableFieldName(LeafItem item)
        {
            string tableName        = item.TableName;
            string cleanedTableName = tableName;

            int bracketLeft  = tableName.LastIndexOf('[');
            int bracketRight = tableName.LastIndexOf(']');

            if (bracketLeft > -1 && bracketRight > -1)
            {
                cleanedTableName = tableName.Substring(bracketLeft + 1, bracketRight - bracketLeft - 1);
            }

            int ind = cleanedTableName.LastIndexOf('_');

            if (ind < 0)
            {
                item.TableName = cleanedTableName;
            }
            else
            {
                string prefix         = cleanedTableName.Substring(0, ind + 1);
                string tableNameShort = cleanedTableName.Substring(ind + 1);

                //item.TableName = prefix + _mainTable + "View";
                item.TableName = prefix + "mainETableView";
                if (!string.IsNullOrEmpty(item.Fieldname))
                {
                    item.Fieldname = tableNameShort.Replace('-', '_') + "_" + item.Fieldname;
                }
            }
        }
Esempio n. 4
0
            protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
            {
                IList <TreeViewItem> items = FindRows(args.draggedItemIDs);

                if (items[0] is LeafItem)
                {
                    LeafItem item = items[0] as LeafItem;

                    DragAndDrop.PrepareStartDrag();
                    DragAndDrop.objectReferences = new UnityEngine.Object[] { Instantiate(item.Data) };

                    string title = string.Empty;

                    if (item.Data is EditorEventRef)
                    {
                        title = "New FMOD Studio Emitter";
                    }
                    else if (item.Data is EditorBankRef)
                    {
                        title = "New FMOD Studio Bank Loader";
                    }
                    else if (item.Data is EditorParamRef)
                    {
                        title = "New FMOD Studio Global Parameter Trigger";
                    }

                    DragAndDrop.StartDrag(title);
                }
            }
Esempio n. 5
0
            private void CreateSubTree <T>(string rootName, string rootPath,
                                           IEnumerable <T> sourceRecords, Func <T, string> GetPath,
                                           Texture2D icon, Func <string, T, string> MakeUniquePath = null)
                where T : ScriptableObject
            {
                var records = sourceRecords.Select(r => new { source = r, path = GetPath(r) });

                if (hasSearch)
                {
                    records = records.Where(r => {
                        foreach (var word in searchStringSplit)
                        {
                            if (word.Length > 0 && r.path.IndexOf(word, StringComparison.OrdinalIgnoreCase) < 0)
                            {
                                return(false);
                            }
                        }
                        return(true);
                    });
                }

                records = records.OrderBy(r => r.path, naturalComparer);

                TreeViewItem root =
                    CreateFolderItem(rootName, rootPath, records.Any(), TypeFilter != TypeFilter.All, rootItem);

                List <TreeViewItem> currentFolderItems = new List <TreeViewItem>();

                foreach (var record in records)
                {
                    string       leafName;
                    TreeViewItem parent = CreateFolderItems(record.path, currentFolderItems, root, out leafName);

                    if (parent != null)
                    {
                        string uniquePath;

                        if (MakeUniquePath != null)
                        {
                            uniquePath = MakeUniquePath(record.path, record.source);
                        }
                        else
                        {
                            uniquePath = record.path;
                        }

                        TreeViewItem leafItem = new LeafItem(AffirmItemID(uniquePath), 0, record.source);
                        leafItem.displayName = leafName;
                        leafItem.icon        = icon;

                        parent.AddChild(leafItem);
                    }
                }
            }
Esempio n. 6
0
        private List <LeafItem> LoadDefaultQueryItems()
        {
            char[]        fieldDelimter    = new char[] { ';' };
            char[]        fldValuedelimter = new char[] { ':' };
            CompareType[] compareTypes     = new CompareType[] { CompareType.Equals, CompareType.IsNotNull, CompareType.IsNull, CompareType.GreaterThan };

            string[] searchTargets = _comboBoxBatchSearch.Text.Split(fieldDelimter, StringSplitOptions.RemoveEmptyEntries);
            if (searchTargets.Length < 1)
            {
                _comboBoxBatchSearch.Text = DemoSearchText;
                searchTargets             = _comboBoxBatchSearch.Text.Split(fieldDelimter, StringSplitOptions.RemoveEmptyEntries);
            }

            List <LeafItem> qItems = new List <LeafItem>(searchTargets.Length);
            string          searchField, searchValue;

            foreach (string fs in searchTargets)
            {
                string[] searchPair = fs.Split(fldValuedelimter);
                if (searchPair.Length < 2)
                {
                    continue;
                }

                searchField = searchPair[0].Trim();
                searchValue = searchPair[1].Trim();
                for (int ind = 0; ind < compareTypes.Length; ind++)
                {
                    CompareType ct = compareTypes[ind];
                    if (searchField.Length < 1 && !(ct == CompareType.Equals || ct == CompareType.NotEqual))
                    {
                        continue;
                    }

                    if (searchValue.Length < 1 && !(ct == CompareType.IsNotNull || ct == CompareType.IsNull))
                    {
                        continue;
                    }

                    LeafItem qi = new LeafItem();
                    qi.TableName   = _targetTbl;
                    qi.Fieldname   = searchField;
                    qi.QueryValue  = searchValue;
                    qi.CompareType = ct;

                    qItems.Add(qi);
                }
            }

            return(qItems);
        }
Esempio n. 7
0
        private MainMenu createMainMenu()
        {
            MainMenu mainMenu             = new MainMenu("Delegete -  Main Menu");
            Menu     versionAndDigitsMenu = new Menu("Version and Digits");
            Menu     showDateTimeMenu     = new Menu("Show Date/Time");
            LeafItem countCapitalItem     = new LeafItem("Count Capital");
            LeafItem showVersionItem      = new LeafItem("Show Version");
            LeafItem showTimeItem         = new LeafItem("Show Time");
            LeafItem showDateItem         = new LeafItem("Show Date");

            countCapitalItem.ItemClicked += countCapitalItem_ItemClicked;
            showVersionItem.ItemClicked  += showVersionItem_ItemClicked;
            showTimeItem.ItemClicked     += showTimeItem_ItemClicked;
            showDateItem.ItemClicked     += showDateItem_ItemClicked;
            versionAndDigitsMenu.AddMenuItems(countCapitalItem);
            versionAndDigitsMenu.AddMenuItems(showVersionItem);
            showDateTimeMenu.AddMenuItems(showTimeItem);
            showDateTimeMenu.AddMenuItems(showDateItem);
            mainMenu.AddMenuItems(versionAndDigitsMenu);
            mainMenu.AddMenuItems(showDateTimeMenu);

            return(mainMenu);
        }
Esempio n. 8
0
        private MainMenu createMainMenu()
        {
            MainMenu mainMenu             = new MainMenu("Interface - Main Menu");
            Menu     versionAndDigitsMenu = new Menu("Version and Digits");
            Menu     showDateTimeMenu     = new Menu("Show Date/Time");
            LeafItem countCapitalItem     = new LeafItem("Count Capital");
            LeafItem showVersionItem      = new LeafItem("Show Version");
            LeafItem showTimeItem         = new LeafItem("Show Time");
            LeafItem showDateItem         = new LeafItem("Show Date");

            countCapitalItem.AttachObserver(this as IActionObserver);
            showVersionItem.AttachObserver(this as IActionObserver);
            showTimeItem.AttachObserver(this as IActionObserver);
            showDateItem.AttachObserver(this as IActionObserver);
            versionAndDigitsMenu.AddMenuItems(countCapitalItem);
            versionAndDigitsMenu.AddMenuItems(showVersionItem);
            showDateTimeMenu.AddMenuItems(showTimeItem);
            showDateTimeMenu.AddMenuItems(showDateItem);
            mainMenu.AddMenuItems(versionAndDigitsMenu);
            mainMenu.AddMenuItems(showDateTimeMenu);

            return(mainMenu);
        }
        protected override void UpdateMenu()
        {
            _filters.Clear();

            if (_engine.GraphState == GraphState.Reset)
            {
                FiltersMenuVisible = false;
            }
            else
            {
                var last = _engine.FilterCount;
                if (last > 15)
                {
                    last = 15;
                }

                var displayPropPageCommand = new GenericRelayCommand <NumberedMenuItemData>(
                    data =>
                {
                    if (data != null)
                    {
                        _engine.DisplayFilterPropPage(_windowHandleProvider.Handle, data.Number, true);
                    }
                },
                    data =>
                {
                    return(data != null && _engine.DisplayFilterPropPage(_windowHandleProvider.Handle, data.Number, false));
                });

                var selectStreamCommand = new GenericRelayCommand <SelectableStreamMenuItemData>(
                    data =>
                {
                    if (data != null)
                    {
                        _engine.SelectStream(data.FilterName, data.StreamIndex);
                    }
                });

                for (var i = 0; i < last; i++)
                {
                    var filterName = _engine.GetFilterName(i);

                    var selectableStreams = _engine.GetSelectableStreams(filterName);
                    var streams           = selectableStreams as IList <SelectableStream> ?? selectableStreams.ToList();
                    if (streams.Any())
                    {
                        var parentItem = new ParentDataItem <NumberedMenuItemData>(filterName, new NumberedMenuItemData(i));
                        parentItem.SubItems.Add(new LeafItem <NumberedMenuItemData>(Resources.Resources.mi_properties, new NumberedMenuItemData(i),
                                                                                    displayPropPageCommand));

                        var grouppedStreams = streams.GroupBy(s => s.MajorType);
                        foreach (var group in grouppedStreams)
                        {
                            parentItem.SubItems.Add(new SeparatorItem());
                            foreach (var stream in group)
                            {
                                var leafItem = new LeafItem <SelectableStreamMenuItemData>(stream.Name,
                                                                                           new SelectableStreamMenuItemData(filterName, stream.Index), selectStreamCommand);
                                leafItem.IsChecked = stream.Enabled;
                                parentItem.SubItems.Add(leafItem);
                            }
                        }

                        _filters.Add(parentItem);
                    }
                    else
                    {
                        _filters.Add(new LeafItem <NumberedMenuItemData>(filterName, new NumberedMenuItemData(i), displayPropPageCommand));
                    }
                }

                FiltersMenuVisible = true;
            }
        }
Esempio n. 10
0
 public void GetLeafItem(out ILeafItem item)
 {
     item        = new LeafItem();
     item.NodeId = _itemCounter++;
 }