Resource paths and UI sizes are stored here as static constants.
Example #1
0
    public string ToString(int subSize)
    {
        string str = "";

        foreach (string sign in fields)
        {
            str += UIConstants.SignFormat(sign, subSize);
        }
        return(str);
    }
Example #2
0
    private void SetText()
    {
        int subSize = UIConstants.TextFontSubSize;

        textMesh.text = UIConstants.SignFormat(sign, subSize);

        Bounds textBounds = textRenderer.bounds;

        MaterialPropertyBlock prop = new MaterialPropertyBlock();

        backgroundRenderer.GetPropertyBlock(prop);
        prop.SetFloat("_ScaleX", textBounds.size.x + SIGN_PADDING_WIDTH);
        prop.SetFloat("_ScaleY", textBounds.size.y);
        backgroundRenderer.SetPropertyBlock(prop);
    }
Example #3
0
        private static void SetUIConstants()
        {
            //代码设置授权码
            WHC.Security.MyConstants.License         = "397cV0hDLlNlY3VybXR5fOS8jeWNjuiBqnzlua-lt57niLHlkK-o_6rmioDmnK-mnInpmZDlhbzlj7h8RmFsc2Uv";
            WHC.Dictionary.MyConstants.License       = "37c6V0hDLkRpY3Rpa25hcnl85LyN5Y2O6IGqfOW5_*W3nueIseWQr*i-qubKgObcr*bciemZkOWFrOWPuHxGYWxzZQvv";
            WHC.Pager.WinControl.MyConstants.License = "070eV0hDLlBhZ2VyfOS8jeWNjuiBqnx8RmFsc2Uv";

            //设置软件信息
            string expiredDate = "12/29/2013"; //标识,并不起作用
            string softName    = "StaffData";  //软件名称,确定存储位置
            string version     = "5.0";        //软件版本
            string publicKey   = "<RSAKeyValue><Modulus>mtDtu679/0quhftVyOc6/cBov/i534Dkh3AB8RwrpC9Vq2RIFB3uvjRUuaAEPR8vMcijQjVzqLZgMM7jFKclzbh21rWTM+YlOeraKz5FPCC7rSLnv6Tfbzia9VI/r5cfM8ogVMuUKCZeU+PTEmVviasCl8nPYyqOQchlf/MftMM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";

            UIConstants.SetValue(expiredDate, version, softName, publicKey);
        }
        /// <summary>
        /// Builds the tree for MenuItem tree view model
        /// </summary>
        /// <param name="node"></param>
        /// <param name="menuItemViewModel"></param>
        void BuildTreeViewModel(ISyntaxEntity node, MenuItemViewModel menuItemViewModel)
        {
            MenuItemViewModel item = new MenuItemViewModel()
            {
                DisplayText = node.DisplayText(),
                SpokenText  = node.SpokenText(),
                Name        = node.DisplayText(),
                LineNumber  = node.Location.StartLineNumber + Constants.GoToLineOffsite,
                Children    = new ObservableCollection <MenuItemViewModel>(),
                IsExpanded  = (node is Block || node is FunctionDefinition)?false:true,
                ImageSource = UIConstants.GetImageSourceFromKind(node)
            };

            if (null == menuItemViewModel)
            {
                treeRootViewModel = item;
            }
            else
            {
                menuItemViewModel.Children.Add(item);
            }

            menuItemViewModel = item;

            if (null == node.Children)
            {
                return;
            }

            foreach (var child in node.Children)
            {
                if (child.Kind == SyntaxEntityKind.Function)
                {
                    if (((child as FunctionDefinition).TypeOfFunction & functionTypesToDisplay) == 0)
                    {
                        continue;
                    }
                }
                BuildTreeViewModel(child, menuItemViewModel);
            }
        }
        public void SetListView(IEnumerable <ISyntaxEntity> entities, string label, bool focusOnFirst = true)
        {
            //Cleaning UI
            listView.Visibility = Visibility.Visible;
            treeView.Visibility = Visibility.Collapsed;
            ListItems.Clear();

            var listItems = entities.Select(entity =>
            {
                return(new MenuItemViewModel()
                {
                    DisplayText = entity.DisplayText(),
                    SpokenText = entity.SpokenText(),
                    Name = entity.DisplayText(),
                    LineNumber = entity.Location.StartLineNumber + Constants.GoToLineOffsite,
                    Children = new ObservableCollection <MenuItemViewModel>(),
                    ImageSource = UIConstants.GetImageSourceFromKind(entity)
                });
                //return new MenuItem(entity.CurrentCodeFile.Language.SpokenText(entity),
                //                                            entity.Location.StartLineNumber);
            });

            foreach (var item in listItems)
            {
                ListItems.Add(item);
            }

            listView.Focus();

            /// Focus explanation:
            /// The ListViewItems are not generated immediately, because of that we can obtain the ListViewItem to shift focus.
            /// Hence we call ListView.UpdateLayout() which pre-generates the ListViewItems.
            /// Since there are only few tens of items expected in the list view, this is acceptable.
            /// In case the list items will go to hundreds or thousands, this is not efficient way, we need to use the
            /// status chaged event of the ItemContainerGenerator to get the ListViewItem.
            if (true == focusOnFirst)
            {
                listView.SelectedItem = listView.Items[0];
                listView.UpdateLayout();
                var item = (ListViewItem)listView.ItemContainerGenerator.ContainerFromItem(listView.Items[0]);
                if (null != item)
                {
                    item.Focus();
                }
            }
            else
            {
                listView.SelectedItem  = listView.Items[listItems.Count() - 1];
                listView.SelectedIndex = listItems.Count() - 1;
                listView.UpdateLayout();
                var item = (ListViewItem)listView.ItemContainerGenerator.ContainerFromItem(listView.Items[listItems.Count() - 1]);
                if (null != item)
                {
                    item.Focus();
                }
            }


            isTreeViewActive = false;

            ResizeControl();
        }
 private static void SetTaskInfo(Models.TaskInfo taskInfo, UIConstants uIConstants)
 {
     taskInfo.Height = uIConstants.Height;
     taskInfo.Width  = uIConstants.Width;
     taskInfo.Title  = uIConstants.Title.ToString();
 }
 public static void SetTaskInfo(TaskInfo taskInfo, UIConstants uIConstants)
 {
     taskInfo.Height = uIConstants.Height;
     taskInfo.Width  = uIConstants.Width;
 }
Example #8
0
 private void SetText(string str)
 {
     text           = str;
     textField.text = UIConstants.SignFormat(text, subSize);
 }
Example #9
0
 private static void SetTaskInfo(Models.TaskInfo taskInfo, UIConstants uIConstants)
 {
     taskInfo.Height = uIConstants.Height;
     taskInfo.Width  = uIConstants.Width;
 }