Пример #1
1
 private FrameworkElement insertPlugin(Dictionary<String, IAddChild> pluginRoots, IAddChild defaultPluginRoot)
 {
     try
     {
         var assembly = System.Reflection.Assembly.LoadFrom(root + "\\" + name + ".dll");
         var pluginMain = assembly.GetType(name + ".PluginMain");
         var pluginInstance = (UserControl)pluginMain.GetConstructor(new Type[0]).Invoke(new object[0]);
         var pluginGroup = new RibbonGroup();
         if (pluginMain.GetFields().Where(f => f.Name == "preferredTab").Count() == 1)
         {
             var preferredTab = (string)pluginMain.GetField("preferredTab").GetValue(pluginInstance);
             if (preferredTab == "PenTools" || preferredTab == "Navigate")
             {
                 pluginRoots[preferredTab].AddChild(pluginInstance);
                 return pluginInstance;
             }
             if (pluginRoots.ContainsKey(preferredTab))
             {
                 pluginGroup.Header = name;
                 pluginGroup.Items.Add(pluginInstance);
                 pluginRoots[preferredTab].AddChild(pluginGroup);
             }
             else
             {
                 throw new InvalidPluginFormatException(name, "This plugin has requested to live in a tab which does not exist: " + preferredTab + ".  Available tabs are: " + pluginRoots.Keys.Aggregate("", (key, acc) => key + " " + acc));
             }
         }
         else
         {
             //Uncomment these lines to make the plugin live in a RibbonGroup that will collapse at priority 9, go to small at 8 and go to medium at 7.
             //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Collapsed,9));
             //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Small,8));
             //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Medium,7));
             pluginGroup.Header = name;
             pluginGroup.Items.Add(pluginInstance);
             defaultPluginRoot.AddChild(pluginGroup);
         }
         return pluginInstance;
     }
     catch (Exception e)
     {
         throw new InvalidPluginFormatException(name, "This plugin has failed to instantiate its main class (which must be named PluginMain) correctly, failing with the error: " + e.Message);
     }
 }
Пример #2
0
        /// <summary>
        /// Create next UI layer and set it as active.
        /// </summary>
        /// <param name="nextLayerRoot">Element that will be root of the new layer.</param>
        public LayoutLayer GoDeeper(IAddChild nextLayerRoot)
        {
            // Validate shared reference.
            if (nextLayerRoot == null)
            {
                throw new NullReferenceException("Root element can't be null.");
            }

            // Add shared root as child on current layer.
            root.AddChild(nextLayerRoot);

            // Configurate new layer.
            var newLayer = new LayoutLayer()
            {
                root   = nextLayerRoot, // Set shared element as root
                Parent = this           // Set reference to current active layer like on the parent.
            };

            // Define orientation of the layout group.
            if (nextLayerRoot is StackPanel)
            {
                newLayer.orientation = Orientation.Vertical;
            }
            else
            {
                newLayer.orientation = Orientation.Horizontal;
            }

            // Return new layer.
            return(newLayer);
        }
Пример #3
0
        private void InitializeComponent()
        {
            //设置窗体大小
            this.Width = 285; this.Height = 250;
            this.Left  = 100; this.Top = 100;
            this.Title = "Create Window By Code";

            //创建一个停靠面板对象,用来放组件
            DockPanel panel = new DockPanel();

            //创建按钮对象
            button1         = new Button();
            button1.Content = "点击";
            button1.Margin  = new Thickness(30);

            //添加事件处理程序
            button1.Click += btn1_Click;

            //将按钮添加到面板中
            IAddChild container = panel;

            container.AddChild(button1);

            //将面板添加到Window窗体中
            container = this;
            container.AddChild(panel);
        }
        // Token: 0x06000698 RID: 1688 RVA: 0x00014E4C File Offset: 0x0001304C
        internal static void AddNodeToLogicalTree(DependencyObject parent, Type type, bool treeNodeIsFE, FrameworkElement treeNodeFE, FrameworkContentElement treeNodeFCE)
        {
            FrameworkContentElement frameworkContentElement = parent as FrameworkContentElement;

            if (frameworkContentElement != null)
            {
                IEnumerator logicalChildren = frameworkContentElement.LogicalChildren;
                if (logicalChildren != null && logicalChildren.MoveNext())
                {
                    throw new InvalidOperationException(SR.Get("AlreadyHasLogicalChildren", new object[]
                    {
                        parent.GetType().Name
                    }));
                }
            }
            IAddChild addChild = parent as IAddChild;

            if (addChild == null)
            {
                throw new InvalidOperationException(SR.Get("CannotHookupFCERoot", new object[]
                {
                    type.Name
                }));
            }
            if (treeNodeFE != null)
            {
                addChild.AddChild(treeNodeFE);
                return;
            }
            addChild.AddChild(treeNodeFCE);
        }
Пример #5
0
 internal static void ApplyTemplate(IAddChild decendant, IEnumerable items)
 {
     foreach (var item in items)
     {
         decendant.AddChild(item);
     }
 }
Пример #6
0
        private void NewImgWindow(string path)
        {
            TempWindow = new Window();
            TempWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            TempWindow.WindowStyle           = WindowStyle.None;
            TempWindow.ResizeMode            = ResizeMode.CanResize;
            TempWindow.AllowsTransparency    = true;

            // Image image = new Image();
            image = new Image();
            ImageSource imageSource = new BitmapImage(new Uri(path));

            image.Source = imageSource;
            image.Margin = new Thickness(0);
            image.HorizontalAlignment = HorizontalAlignment.Left;
            image.VerticalAlignment   = VerticalAlignment.Top;
            image.MouseDown          += Image_MouseDown;
            IAddChild conAddChild = TempWindow;

            conAddChild.AddChild(image);
            TempWindow.Height = imageSource.Height;
            TempWindow.Width  = imageSource.Width;
            TempWindow.Show();
            TempWindow.Topmost = true;
        }
Пример #7
0
        /// <summary>
        /// Adding child to the bertical layout group.
        /// </summary>
        /// <param name="parent">VerticalStackPanel that will contin child.</param>
        /// <param name="element">Element that will be added to the panel as child.</param>
        public static void VerticalLayoutAddChild(IAddChild parent, FrameworkElement element)
        {
            // Validate type cast.
            if (!(parent is VirtualizingStackPanel panel))
            {
                throw new InvalidCastException("Parent mast be `" + typeof(VirtualizingStackPanel).FullName + "`.");
            }

            // Set element to the parent panel.
            panel.Children.Add(element);

            //// Drop ivalid elelment.
            //if (!(parent is Grid grid))
            //{
            //    throw new InvalidCastException("Parent must be `" + typeof(Grid).FullName + "`.");
            //}

            //// Add new column fo element.
            //grid.RowDefinitions.Add(new RowDefinition()
            //{
            //    // define required width.
            //    // Auto - if width of element less or equals 0, or is NaN.
            //    // Shared element's width in case if defined.
            //    Height = double.IsNaN(element.Height) || element.Height <= 0 ?
            //            new GridLength(1, GridUnitType.Star) : new GridLength(element.Height)
            //});

            //// Add element as child.
            //parent.AddChild(element);

            //// Set als column as target for element.
            //Grid.SetRow(element, grid.RowDefinitions.Count - 1);
        }
Пример #8
0
        private void InitializeComponent()
        {
            this.Width = this.Height = 200;
            this.Left  = this.Top = 100;
            this.Title = "Code-Only Window";

            #region Container
            DockPanel dockPanel = new DockPanel();

            _button         = new Button();
            _button.Content = "Click Me";
            _button.Margin  = new Thickness(30);

            _button.Click += (sender, eventArgs) =>
            {
                _button.Content = "Value Changed";
            };

            IAddChild container = dockPanel;
            container.AddChild(_button);

            container = this;
            container.AddChild(dockPanel);

            #endregion
        }
Пример #9
0
        private void InitializeComponent()
        {
            Width  = 500;
            Height = 300;
            Title  = "Code Only";

            Grid grid = new Grid();

            Button btnTest = new Button();

            btnTest.Content             = "测试";
            btnTest.Width               = 100;
            btnTest.Height              = 20;
            btnTest.VerticalAlignment   = VerticalAlignment.Top;
            btnTest.HorizontalAlignment = HorizontalAlignment.Left;
            btnTest.Margin              = new Thickness(30);

            btnTest.Click += BtnTest_Click;

            IAddChild container = grid;

            container.AddChild(btnTest);

            container = this;
            container.AddChild(grid);
        }
Пример #10
0
        protected override Visual ProduceDefaultVisual(object item)
        {
            if (item == null)
            {
                return(null);
            }

            Visual defaultVisual = null;

            if (this.FallbackTemplate != null)
            {
                defaultVisual = this.ProduceVisual(item, this.FallbackTemplate);
            }
            if (defaultVisual == null)
            {
                return(base.ProduceDefaultVisual(item));
            }
            else
            {
                IAddChild textHost = defaultVisual as IAddChild;
                if (textHost != null)
                {
                    try
                    {
                        textHost.AddText(string.Format(CultureInfo.CurrentCulture, "DataTemplateNotFound: {0}", item.GetType().Name));
                    }
                    catch (ArgumentException)
                    {
                        // We can cope with failure to add text.
                    }
                }
            }

            return(defaultVisual);
        }
Пример #11
0
        private void InitializeComponent()
        {
            //Configure the form
            this.Width = this.Height = 285;
            this.Left  = this.Top = 100;
            this.Title = "Code-Only Window";

            //Create a container to hold a button
            DockPanel panel = new DockPanel();

            //Create the button
            button1         = new Button();
            button1.Content = "Please click me.";
            button1.Margin  = new Thickness(30);

            //Attach the event handler
            button1.Click += button1_Click;

            //Place the button in the panel.
            IAddChild container = panel;

            container.AddChild(button1);

            //Place the panel in the form.
            container = this;
            container.AddChild(panel);
        }
        private void InitializeComponent()
        {
            var panel = new StackPanel();

            panel.Orientation = Orientation.Vertical;
            IAddChild container = panel;

            if (Questions.Sections == null)
            {
                this.UpdateLayout(); return;
            }
            ;
            var setText = new TextBlock
            {
                Text = "Тема теста: \"" + Questions.Name + "\""
            };
            int sectionNumber = 1;

            container.AddChild(setText);
            container.AddChild(new Separator());
            foreach (var section in Questions.Sections)
            {
                int questionNumber = 1;
                var sectionText    = new TextBlock
                {
                    Text = sectionNumber + ") Раздел \"" + section.Name + "\""
                };
                container.AddChild(sectionText);
                foreach (var question in section.Questions)
                {
                    var questionText = new TextBlock
                    {
                        Text                = questionNumber + ". " + question.Text,
                        TextWrapping        = TextWrapping.Wrap,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Width               = 650d
                    };
                    container.AddChild(questionText);
                    int answerNumber = 1;
                    foreach (var answer in question.Answers)
                    {
                        var radio = new RadioButton
                        {
                            Content   = answer.Text,
                            GroupName = "Group_" + sectionNumber + "_" + questionNumber,
                            Tag       = new Tuple <Question, Answer>(question, answer)
                        };
                        radio.Checked += Radio_Checked;
                        container.AddChild(radio);
                        answerNumber++;
                    }
                    questionNumber++;
                }
                container.AddChild(new Separator());
                sectionNumber++;
            }

            container = this;
            container.AddChild(panel);
        }
Пример #13
0
        private void InitializeComponent()
        {
            //设置窗体
            this.Width  = 285;
            this.Height = 250;
            this.Left   = this.Top = 100;
            this.Title  = "Use code to create wpf application.";

            //创建停靠的面板对象
            DockPanel panel = new DockPanel();

            //创建按钮对象
            button1         = new Button();
            button1.Content = "Click me";
            button1.Margin  = new Thickness(30);
            button1.Click  += Button1_Click;

            //创建容器
            IAddChild container = panel;

            container.AddChild(button1);

            container = this;
            container.AddChild(panel);
        }
Пример #14
0
        private void NewTextWindow(string str)
        {
            //创建基本窗口
            Window newWindow = new Window();

            newWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newWindow.WindowStyle           = WindowStyle.ThreeDBorderWindow;
            newWindow.ResizeMode            = ResizeMode.CanResize;
            //newWindow.AllowsTransparency=true;
            //创建组件容器

            TextBox textBox1 = new TextBox();

            textBox1.Text         = str;
            textBox1.TextWrapping = TextWrapping.WrapWithOverflow;
            textBox1.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            textBox1.AcceptsReturn     = true;
            textBox1.Margin            = new Thickness(0);
            textBox1.VerticalAlignment = VerticalAlignment.Top;
            IAddChild conAddChild = newWindow;

            conAddChild.AddChild(textBox1);

            newWindow.Show();
            newWindow.Topmost = true;
        }
Пример #15
0
 public FrameworkElement Load(Dictionary<String, IAddChild> parent, IAddChild defaultPluginRoot)
 {
     root = "plugins\\" + name;
     validateThisPlugin();
     loadDependencies();
     loadMainClass();
     return insertPlugin(parent, defaultPluginRoot);
 }
Пример #16
0
        public static BindingList <T> AttachTo <T>(this BindingList <T> e, IAddChild c)
            where T : ISupportsContainer
        {
            e.ForEachNewOrExistingItem(k => k.AttachContainerTo(c));
            e.ForEachItemDeleted(k => k.OrphanizeContainer());

            return(e);
        }
Пример #17
0
 public static void AttachTo <T>(this T[] e, IAddChild c)
     where T : UIElement
 {
     foreach (var k in e)
     {
         k.AttachTo(c);
     }
 }
Пример #18
0
 public IAddChild AppendCefBrowser(IAddChild container)
 {
     if (Browser == null)
     {
         throw new InvalidOperationException("必须先InitCefBrowser,然后才能使用");
     }
     container.AddChild(Browser);
     return(container);
 }
Пример #19
0
        public PropertyWindowUI(IAddChild parent) : base(parent)
        {
            propertyList = new List <PropertyUI>();

            layout.RowDefinitions.Add(
                new RowDefinition()
            {
                Height = GridLength.Auto
            }
                );
            layout.RowDefinitions.Add(
                new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            }
                );

            stackScrollViewer = new ScrollViewer()
            {
                Width  = double.NaN,
                Height = double.NaN,
                HorizontalAlignment           = HorizontalAlignment.Stretch,
                VerticalAlignment             = VerticalAlignment.Stretch,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
                Background = Brushes.White
            };

            stackPanel = new StackPanel()
            {
                Width  = double.NaN,
                Height = double.NaN,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            stackNameLabel = new Label()
            {
                Width  = double.NaN,
                Height = double.NaN,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Top,
                FontSize            = 24,
                Content             = "null",
                Background          = Brushes.White
            };

            Panel.SetZIndex(stackScrollViewer, -10);
            Panel.SetZIndex(stackNameLabel, 10);

            Grid.SetRow(stackNameLabel, 0);
            Grid.SetRow(stackScrollViewer, 1);

            stackScrollViewer.Content = stackPanel;
            layout.Children.Add(stackNameLabel);
            layout.Children.Add(stackScrollViewer);
        }
Пример #20
0
        private static void AddInline([NotNull] IAddChild parent, [NotNull] Inline inline)
        {
            if (!EndsWithSpace(parent) && !StartsWithSpace(inline))
            {
                parent.AddText(" ");
            }

            parent.AddChild(inline);
        }
Пример #21
0
        internal static void EscapeHtml(StringContent inp, IAddChild target)
        {
            //var parts = inp.RetrieveParts();
            //for (var i = parts.Offset; i < parts.Offset + parts.Count; i++)
            //{
            //	var part = parts.Array[i];
            //}

            target.AddText(inp.ToString().TrimEnd());
        }
Пример #22
0
 public void LoadXaml(IAddChild parent = null)
 {
     if (Control != null)
     {
         initiatorObj.dispose(Control, CodeHandler);
         loader.Update();
     }
     Control = loader.View;
     parent?.AddChild(Control);
     initiatorObj.initiate(Control, CodeHandler);
 }
Пример #23
0
        /// <summary>
        /// Adding child to the bertical layout group.
        /// </summary>
        /// <param name="parent">VerticalStackPanel that will contin child.</param>
        /// <param name="element">Element that will be added to the panel as child.</param>
        public static void VerticalLayoutAddChild(IAddChild parent, FrameworkElement element)
        {
            // Validate type cast.
            if (!(parent is StackPanel panel))
            {
                throw new InvalidCastException("Parent mast be `" + typeof(StackPanel).FullName + "`.");
            }

            // Set element to the parent panel.
            panel.Children.Add(element);
        }
Пример #24
0
 public static List<FrameworkElement> LoadPlugins(Dictionary<string, IAddChild> pluginRoot, IAddChild defaultPluginRoot)
 {
     try
     {
         return Manifest.Load().Select(plugin => plugin.Load(pluginRoot, defaultPluginRoot)).ToList();
     }
     catch (Exception e)
     {
         return new List<FrameworkElement>();
     }
 }
Пример #25
0
        public WindowUI(IAddChild parent)
        {
            layout = new Grid()
            {
                Width     = double.NaN,
                Height    = double.NaN,
                Focusable = false
            };

            parent.AddChild(layout);
        }
Пример #26
0
            public IAddChildMembersCallTheOtherMembersContentControl()
            {
                IAddChild add_child = (IAddChild)this;

                Assert.AreEqual(add_child_calls, 0, "1");
                add_child.AddChild(1);
                Assert.AreEqual(add_child_calls, 1, "2");
                Content = null;
                Assert.AreEqual(add_text_calls, 0, "3");
                add_child.AddText("1");
                Assert.AreEqual(add_text_calls, 1, "4");
            }
Пример #27
0
        public static Gamma AddNewGamma(this IAddChild <Gamma> source, int a)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            Gamma g = new Gamma();

            source.AddChild(g);
            return(g);
        }
Пример #28
0
        public static T AttachContainerTo <T>(this T e, IAddChild c)
            where T : ISupportsContainer
        {
            if (e == null)
            {
                return(e);
            }

            e.Container.AttachTo(c);

            return(e);
        }
Пример #29
0
        /// <summary> Constructor.
        /// </summary>
        /// <param name="model">The tree model to view.</param>
        public View(Model model, IAddChild visualRoot)
        {
            _model      = model;
            _visualRoot = visualRoot;

            _renderer   = new Renderer(_model, this);
            _controller = new Controller(_renderer);

            _visualRoot.AddChild(_renderer);

            this.StartMouseListening();
        }
Пример #30
0
        /// <summary> Constructor. 
        /// </summary>
        /// <param name="model">The tree model to view.</param>
        public View(Model model, IAddChild visualRoot)
        {
            _model = model;
            _visualRoot = visualRoot;

            _renderer = new Renderer(_model, this);
            _controller = new Controller(_renderer);

            _visualRoot.AddChild(_renderer);

            this.StartMouseListening();
        }
Пример #31
0
        /// <summary>
        /// The toolbar tray which will be used in the application
        /// </summary>
        private void RefreshToolbar()
        {
            ToolBarTray tray  = new ToolBarTray();
            IAddChild   child = tray;

            foreach (AbstractCommandable node in _toolbarService.Children)
            {
                if (node is AbstractToolbar value)
                {
                    ToolBar tb = new ToolBar();

                    DataTemplateSelector t = FindResource("toolBarItemTemplateSelector") as DataTemplateSelector;
                    tb.SetValue(ItemsControl.ItemTemplateSelectorProperty, t);

                    //Set the necessary bindings
                    Binding bandBinding       = new Binding("Band");
                    Binding bandIndexBinding  = new Binding("BandIndex");
                    Binding visibilityBinding = new Binding("IsChecked")
                    {
                        Converter = btv
                    };

                    bandBinding.Source       = value;
                    bandIndexBinding.Source  = value;
                    visibilityBinding.Source = value;

                    bandBinding.Mode      = BindingMode.TwoWay;
                    bandIndexBinding.Mode = BindingMode.TwoWay;

                    tb.SetBinding(ToolBar.BandProperty, bandBinding);
                    tb.SetBinding(ToolBar.BandIndexProperty, bandIndexBinding);
                    tb.SetBinding(ToolBar.VisibilityProperty, visibilityBinding);

                    tb.ItemsSource = value.Children;
                    child.AddChild(tb);
                }
            }

            // update context menu if available
            tray.ContextMenu = null;
            if (_toolbarService.ContextMenuItems != null && _toolbarService.ContextMenuItems.Children.Count() > 0)
            {
                // Update Context Menu
                tray.ContextMenu = new ContextMenu
                {
                    ItemsSource        = _toolbarService.ContextMenuItems.Children,
                    ItemContainerStyle = FindResource("ToolbarContextMenu") as Style,
                };
            }

            content.Content = tray;
        }
Пример #32
0
        private void HandleImage(Inline inline, IAddChild parent)
        {
            NoteFile  nf     = CurrentNote.Files.FirstOrDefault(n => n.FileName == inline.TargetUrl);
            Paragraph result = parent as Paragraph;

            if (result == null)
            {
                result = new Paragraph();
                parent.AddChild(result);
            }

            if (nf != null && File.Exists(nf.FullName))
            {
                if (!string.IsNullOrWhiteSpace(inline.LiteralContent))
                {
                    result.ToolTip = inline.LiteralContent;
                }

                var imageUri = new Uri(nf.FullName, UriKind.Absolute);

                var imgTemp = new BitmapImage();
                imgTemp.BeginInit();
                imgTemp.CacheOption   = BitmapCacheOption.OnLoad;
                imgTemp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                imgTemp.UriSource     = imageUri;
                imgTemp.EndInit();

                var image = new Image
                {
                    Source           = imgTemp,
                    Stretch          = Stretch.None,
                    StretchDirection = StretchDirection.Both,
                    MaxWidth         = imgTemp.Width,
                    MaxHeight        = imgTemp.Height
                };

                if (ImageStyle != null)
                {
                    image.Style = ImageStyle;
                }


                result.Inlines.Add(image);
            }
            else if (nf != null)
            {
                result.Inlines.Add(new Run("Missing file: " + nf.FullName));
            }
        }
Пример #33
0
        private void AddLeaf(double x, double y)
        {
            TextBox leafItem = new TextBox();

            leafItem.Text                = "Leaf";
            leafItem.Margin              = new Thickness(x - 190, y - 80, 0, 0);
            leafItem.Style               = this.FindResource("LeafMind") as Style;
            leafItem.MouseLeftButtonUp  += GetPositionHandler;
            leafItem.MouseRightButtonUp += DrawLineHandler;
            IAddChild container = null;

            container = MyGrid;
            container.AddChild(leafItem);
            leafItem.TextChanged += CompositeCreateHandler;
        }
Пример #34
0
        private void AddBrunch(double x, double y)
        {
            TextBox brunchItem = new TextBox();

            brunchItem.Text   = "Branch";
            brunchItem.Margin = new Thickness(x - 190, y - 80, 0, 0);
            brunchItem.Style  = this.FindResource("BrunchMind") as Style;
            IAddChild container = null;

            brunchItem.MouseLeftButtonUp  += GetPositionHandler;
            brunchItem.MouseRightButtonUp += DrawLineHandler;
            container = MyGrid;
            container.AddChild(brunchItem);
            brunchItem.TextChanged += CreateBrunchHandler;
        }
 public void Build()
 {
     sWindow = new Window {Width = 350, Height = 500, Title = "Настройки"};
     var scrollViewer = new ScrollViewer();
     scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
     var stackPanel = new StackPanel {Margin = new Thickness(5)};
     container = scrollViewer;
     container.AddChild(stackPanel);
     mainStackPanel = stackPanel;
     settings.ForEachSetByUserFieldsGroup(CreatePropertiesExpander, FillGroup);
     var bSave = new Button {Content = "Сохранить"};
     bSave.Click += bSave_Click;
     (mainStackPanel as IAddChild).AddChild(bSave);
     container = sWindow;
     container.AddChild(scrollViewer);
     sWindow.ShowDialog();
 }
Пример #36
0
            public Factory(string Path, IAddChild Container)
            {
                this.ToImage =
                    k => new Image
                    {
                        Source = (Path + "/" + k + ".png").ToSource(),
                    }.AttachTo(Container);

                this.ToWaterImages =
                    a =>
                        a.ToArray(
                            k => new Image
                            {
                                Source = (Path + "/" + k + ".png").ToSource(),
                                Opacity = DefaultWaterOpacity,
                                Visibility = Visibility.Hidden
                            }.AttachTo(Container)
                        );

                this.ToHiddenImages =
                    a =>
                        a.ToArray(
                            k => new Image
                            {
                                Source = (Path + "/" + k + ".png").ToSource(),
                                Visibility = Visibility.Hidden
                            }.AttachTo(Container)
                        );
            }
 private void CreatePropertiesExpander(string groupCaption)
 {
     var expander = new Expander();
     expander.Header = groupCaption;
     (mainStackPanel as IAddChild).AddChild(expander);
     container = expander;
     var stackPanel = new StackPanel();
     container.AddChild(stackPanel);
     container = stackPanel;
 }