MainWindow.xaml 的交互逻辑
Inheritance: System.Windows.Window
Example #1
0
 public static void Main(string[] args)
 {
     Application.Init ();
     MainWindow win = new MainWindow ();
     win.Show ();
     Application.Run ();
 }
        public static void GoBabyGo()
        {
            tempWindow = new MainWindow();
            tempWindow.Show();

            Application.Current.MainWindow.AddHandler(UIElement.PreviewMouseDownEvent, new MouseButtonEventHandler((o, e) =>
                {
                    FrameworkElement element = e.OriginalSource as FrameworkElement;

                    if (element != null)
                    {
                        //Label l = new Label() { Content = PathToString(GenerateTypePath(GetNearestLogicalParent(element))) };
                        Label l = new Label() { Content = PathToString(GenerateTypePath(element)) };
                        DockPanel.SetDock(l, Dock.Top);
                        tempWindow.MainStackPanel.Children.Add(l);
                    }
                }), true);

            Application.Current.MainWindow.AddHandler(UIElement.PreviewMouseMoveEvent, new MouseEventHandler((o, e) =>
            {
                FrameworkElement element = e.OriginalSource as FrameworkElement;

                if (element != null)
                {
                    //element = GetNearestLogicalParent(element);

                    if (element != adornedElement)
                    {
                        if (adornedElement != null)
                        {
                            AdornerLayer oldElementLayer = AdornerLayer.GetAdornerLayer(adornedElement);

                            if (oldElementLayer != null)
                            {
                                Adorner[] toRemoveArray = oldElementLayer.GetAdorners(adornedElement);
                                if (toRemoveArray != null)
                                {
                                    foreach (Adorner a in toRemoveArray)
                                    {
                                        if (a is BorderAdorner)
                                            oldElementLayer.Remove(a);
                                    }
                                }
                            }
                        }

                        AdornerLayer layer = AdornerLayer.GetAdornerLayer(element);
                        if (layer != null)
                        {
                            BorderAdorner ba = new BorderAdorner(element);
                            ba.IsHitTestVisible = false;
                            layer.Add(ba);
                        }

                        adornedElement = element;
                    }
                }
            }), true);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MW = ((Test.MainWindow)(target));
                return;

            case 2:
                this.Buttons = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:

            #line 43 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnSellClick);

            #line default
            #line hidden
                return;

            case 4:

            #line 52 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnBuyClick);

            #line default
            #line hidden
                return;

            case 5:

            #line 62 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnFilterClicked);

            #line default
            #line hidden
                return;

            case 6:

            #line 70 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Exit);

            #line default
            #line hidden
                return;

            case 7:
                this.WorkStack = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 8:
                this.bkgImg = ((System.Windows.Controls.Image)(target));
                return;

            case 9:
                this.Buy = ((Test.Buy)(target));
                return;

            case 10:
                this.Sell = ((Test.Sell)(target));
                return;

            case 11:
                this.Filter = ((Test.Filter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #4
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.MW = ((Test.MainWindow)(target));
     return;
     case 2:
     this.Buttons = ((System.Windows.Controls.StackPanel)(target));
     return;
     case 3:
     
     #line 43 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnSellClick);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 52 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnBuyClick);
     
     #line default
     #line hidden
     return;
     case 5:
     
     #line 62 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnFilterClicked);
     
     #line default
     #line hidden
     return;
     case 6:
     
     #line 70 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Exit);
     
     #line default
     #line hidden
     return;
     case 7:
     this.WorkStack = ((System.Windows.Controls.StackPanel)(target));
     return;
     case 8:
     this.bkgImg = ((System.Windows.Controls.Image)(target));
     return;
     case 9:
     this.Buy = ((Test.Buy)(target));
     return;
     case 10:
     this.Sell = ((Test.Sell)(target));
     return;
     case 11:
     this.Filter = ((Test.Filter)(target));
     return;
     }
     this._contentLoaded = true;
 }