Exemple #1
0
        public dynWatch()
        {
            //add a list box
            System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
            tb.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            //turn off the border
            SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0));

            tb.Background      = backgroundBrush;
            tb.BorderThickness = new Thickness(0);

            WatchValue = "Ready to watch!";

            //http://learnwpf.com/post/2006/06/12/How-can-I-create-a-data-binding-in-code-using-WPF.aspx

            System.Windows.Data.Binding b = new System.Windows.Data.Binding("WatchValue");
            b.Source = this;

            tb.SetBinding(System.Windows.Controls.TextBox.TextProperty, b);

            this.inputGrid.Children.Add(tb);
            tb.TextWrapping = System.Windows.TextWrapping.Wrap;
            tb.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;

            InPortData.Add(new PortData(null, "", "The Element to watch", typeof(dynElement)));

            base.RegisterInputsAndOutputs();

            //resize the panel
            this.topControl.Height = 100;
            this.topControl.Width  = 300;
            UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);

            Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });
        }
Exemple #2
0
        public dynDataFromFile()
        {
            StackPanel myStackPanel;

            //Define a StackPanel
            myStackPanel = new StackPanel();
            myStackPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
            System.Windows.Controls.Grid.SetRow(myStackPanel, 1);

            this.inputGrid.Children.Add(myStackPanel);

            //add a button to the inputGrid on the dynElement
            System.Windows.Controls.Button readFileButton = new System.Windows.Controls.Button();

            System.Windows.Controls.Grid.SetColumn(readFileButton, 0); // trying to get this button to be on top... grrr.
            System.Windows.Controls.Grid.SetRow(readFileButton, 0);
            readFileButton.Margin = new System.Windows.Thickness(0, 0, 0, 0);
            readFileButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            readFileButton.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            readFileButton.Click += new System.Windows.RoutedEventHandler(readFileButton_Click);
            readFileButton.Content = "Read File";
            readFileButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            readFileButton.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            myStackPanel.Children.Add(readFileButton);

            //add a list box
            //label = new System.Windows.Controls.Label();
            System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
            //tb.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            //tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            DataFromFileString = "Ready to read file!";

            //http://learnwpf.com/post/2006/06/12/How-can-I-create-a-data-binding-in-code-using-WPF.aspx

            //this.inputGrid.Children.Add(label);
            //this.inputGrid.Children.Add(tb);
            //tb.Visibility = System.Windows.Visibility.Hidden;
            //System.Windows.Controls.Grid.SetColumn(tb, 0);
            //System.Windows.Controls.Grid.SetRow(tb, 1);
            tb.TextWrapping = System.Windows.TextWrapping.Wrap;
            tb.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            tb.Height = 100;
            //tb.AcceptsReturn = true;

            System.Windows.Data.Binding b = new System.Windows.Data.Binding("DataFromFileString");
            b.Source = this;
            tb.SetBinding(System.Windows.Controls.TextBox.TextProperty, b);

            myStackPanel.Children.Add(tb);
            myStackPanel.Height = 200;

            //InPortData.Add(new PortData(null, "", "The Element to watch", typeof(dynElement)));
            InPortData.Add(new PortData(null, "F", "Watch File?", typeof(dynElement)));
            //InPortData.Add(new PortData(null, "tim", "How often to receive updates.", typeof(dynTimer)));

            OutPortData.Add(new PortData(null, "", "downstream data", typeof(dynDataFromFile)));
            this.Tree.Trunk.Branches.Add(new DataTreeBranch());
            this.Tree.Trunk.Branches[0].Leaves.Add(DataFromFileString);
            OutPortData[0].Object = this.Tree;

            base.RegisterInputsAndOutputs();

            //resize the panel
            this.topControl.Height = 200;
            this.topControl.Width = 300;
            UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);
            Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });
            //this.UpdateLayout();
        }
Exemple #3
0
        public dynComputeSolarRadiationValue()
        {
            //add a list box
            //label = new System.Windows.Controls.Label();
            System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
            tb.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            WatchValue = "Ready to compute solar radiation value!";

            //http://learnwpf.com/post/2006/06/12/How-can-I-create-a-data-binding-in-code-using-WPF.aspx

            System.Windows.Data.Binding b = new System.Windows.Data.Binding("WatchValue");
            b.Source = this;
            //label.SetBinding(System.Windows.Controls.Label.ContentProperty, b);
            tb.SetBinding(System.Windows.Controls.TextBox.TextProperty, b);

            this.inputGrid.Children.Add(tb);
            tb.TextWrapping = System.Windows.TextWrapping.Wrap;
            tb.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //tb.AcceptsReturn = true;

            InPortData.Add(new PortData(null, "", "The solar radiation data file", typeof(dynElement)));

            OutPortData.Add(new PortData(null, "", "The solar radiation computed data", typeof(dynDouble)));
            this.Tree.Trunk.Branches.Add(new DataTreeBranch());
            this.Tree.Trunk.Branches[0].Leaves.Add(SumValue); //MDJ TODO - cleanup input tree and output tree
            //OutPortData[0].Object = this.Tree;
            OutPortData[0].Object = SumValue;

            base.RegisterInputsAndOutputs();

            //resize the panel
            this.topControl.Height = 100;
            this.topControl.Width = 300;
            UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);
            Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });
            //this.UpdateLayout();
        }
Exemple #4
0
        public dynWatch()
        {
            //add a list box
            System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
            tb.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            //turn off the border
            SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0));
            tb.Background = backgroundBrush;
            tb.BorderThickness = new Thickness(0);

            WatchValue = "Ready to watch!";

            //http://learnwpf.com/post/2006/06/12/How-can-I-create-a-data-binding-in-code-using-WPF.aspx

            System.Windows.Data.Binding b = new System.Windows.Data.Binding("WatchValue");
            b.Source = this;
            //label.SetBinding(System.Windows.Controls.Label.ContentProperty, b);
            tb.SetBinding(System.Windows.Controls.TextBox.TextProperty, b);

            //this.inputGrid.Children.Add(label);
            this.inputGrid.Children.Add(tb);
            tb.TextWrapping = System.Windows.TextWrapping.Wrap;
            tb.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //tb.AcceptsReturn = true;

            InPortData.Add(new PortData(null, "", "The Element to watch", typeof(dynElement)));

            base.RegisterInputsAndOutputs();

            //resize the panel
            this.topControl.Height = 100;
            this.topControl.Width = 300;
            UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);
            Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });
            //this.UpdateLayout();
        }