Ejemplo n.º 1
0
        public static Image GetImageFromTool(ToolListItem item)
        {
            if (Cache.TryGetValue(item.Icon, out Image value))
            {
                return(value);
            }
            else
            {
                Image image = new Image(GetImageUri(item.Icon));

                Cache.Add(item.Icon, image);

                return(image);
            }
        }
Ejemplo n.º 2
0
        private void ToolListButton_Click(object sender, RoutedEventArgs e)
        {
            ToolListItem item = sender as ToolListItem;

            if (json != null && json.list != null)
            {
                Cell c = json.list[item.INDEX - 1];
                TBoxName.Text  = c.name;
                priviousName   = c.name;
                TBoxAVO.Text   = c.avo.ToString();
                TBoxDEF.Text   = c.def.ToString();
                TBoxALT.Text   = c.alt.ToString();
                TBoxOTHER.Text = c.other;
            }
        }
Ejemplo n.º 3
0
        private void ButtonSelecte(ToolButton btn)
        {
            if (CellListBox.SelectedIndex == -1)
            {
                return;
            }
            int index = CellListBox.SelectedIndex;
            // 处理一下颜色问题
            ToolListItem item    = CellListBox.SelectedItem as ToolListItem;
            Binding      binding = new Binding();

            binding.Source = item.indexer;
            binding.Path   = new System.Windows.PropertyPath(BorderBrushProperty);
            btn.SetBinding(BackgroundProperty, binding);
            // 数据层
            btn.C        = json.list[index];
            isChangedMap = 1;
        }
Ejemplo n.º 4
0
        private void ReloadCellList()
        {
            IList <Cell> list = json.list;

            if (list != null)
            {
                if (CellListBox.Items.Count != 0)
                {
                    CellListBox.Items.Clear();
                }
                int index = 1;
                foreach (Cell item in list)
                {
                    var listItem = new ToolListItem(item, index);
                    item.idx           = index;
                    listItem.Selected += ToolListButton_Click;
                    CellListBox.Items.Add(listItem);
                    index++;
                }
            }
            listName.Content = json.name;
        }