Exemplo n.º 1
0
        void client_GetBlockInfoCompleted(object sender, GetBlockInfoCompletedEventArgs e)
        {
            List <BaseParam> bufferParams = e.Result.ToList();
            ParamsInBlock    curParams    = new ParamsInBlock();

            foreach (var item in bufferParams)
            {
                curParams.Params.Add(item.name, item);
            }
            curParams.BlockTypeId   = AllBlockTypes.First(a => a.Value == curParams.Params.First().Value.BlockType).Key;
            curParams.BlockTypeName = AllBlockTypes[curParams.BlockTypeId];

            BlockParams.Add(curParams.BlockTypeName, curParams);
        }
Exemplo n.º 2
0
        private void ShowBlockSettings(Block block)
        {
            PropertiesBar.Children.Clear();
            ParamsInBlock curBlockParams = BlockParams[block.typename];

            if (block.name == "Пустой")
            {
                TextBlock blockType = new TextBlock();
                blockType.Name        = "blockType";
                blockType.Text        = block.typename;
                blockType.DataContext = block.typeid;
                blockType.FontWeight  = FontWeights.Bold;
                PropertiesBar.Children.Add(blockType);

                TextBlock name = new TextBlock();
                name.Text     = "Назовите блок";
                name.FontSize = 14;
                name.Margin   = new Thickness(1, 5, 1, 5);
                PropertiesBar.Children.Add(name);

                TextBox options = new TextBox();
                options.Text       = block.name;
                options.Name       = "blockName";
                options.Margin     = new Thickness(1, 0, 1, 5);
                options.FontWeight = FontWeights.Bold;
                PropertiesBar.Children.Add(options);

                foreach (var item in curBlockParams.Params)
                {
                    if (item.Value.listParam)
                    {
                        PropertiesBar.Children.Add(
                            new MultiValueParam(
                                new _Condition()
                        {
                            Operation = "Не использовать", Property = item.Value.name, Value = ""
                        }
                                , item.Value));
                    }
                    else
                    {
                        PropertiesBar.Children.Add(
                            new SingleValueParam(
                                new _Condition()
                        {
                            Operation = "Не использовать", Property = item.Value.name, Value = ""
                        }
                                , item.Value));
                    }
                }

                Button SaveButton = new Button();
                SaveButton.Content = "Save";
                SaveButton.Height  = 70;
                SaveButton.Margin  = new Thickness(3);
                SaveButton.Click  += new RoutedEventHandler(SaveButton_Click);
                PropertiesBar.Children.Add(SaveButton);
            }
            else
            {
                TextBlock options = new TextBlock();
                options.Text       = "Block properties: " + block.name;
                options.FontWeight = FontWeights.Bold;
                PropertiesBar.Children.Add(options);

                if (block.settings.Conditions != null)
                {
                    foreach (var item in block.settings.Conditions)
                    {
                        BaseParam curParam = curBlockParams.Params[item.Property];

                        if (curParam.listParam)
                        {
                            PropertiesBar.Children.Add(new MultiValueParam(item, curParam));
                        }
                        else
                        {
                            PropertiesBar.Children.Add(new SingleValueParam(item, curParam));
                        }
                    }
                }
            }
        }