MainPage.xaml_1121

 前台

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Theme="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.Toolkit"
    xmlns:local="clr-namespace:ComputerDropDragControl;assembly=ComputerDropDragControl"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
                          HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
       
           
               
                   
               

               
                   
                                                                    ExpandDirection="Down"  FlowDirection="LeftToRight"
                                            VerticalAlignment="Top" >
                           
                               
                                   
                                   

                               

                           
                           
                               
                                   
                                   

                               

                           
                           
                               
                                   
                                   

                               

                           
                           
                               
                                                                                    VerticalAlignment="Top" Margin="30,0,0,0">
                                   

                               

                           
                       
                   

               

               
               
                   
                                                              VerticalScrollBarVisibility="Auto">
                           
                           
                               
                                   
                                   

                                   
                               

                           

                       

                   

               

               
           

           
               
               
                   
                   

                                                        Foreground="White">
                   
                       
                                                                                       Storyboard.TargetProperty="Opacity" RepeatBehavior="Forever">
                               
                               
                               
                           

                       

                   

               

               
           

       

   


 

后台

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using GDev.PopupBox;
using System.Windows.Browser;
using System.Net.NetworkInformation;

namespace ComputerDropDragControl
{
    ///


    /// 机器处理界面
    /// 创建人:吴兆娟
    /// 创建时间:2011-10-24
    ///

    public partial class MainPage : UserControl
    {
        #region <<页面加载>>

        ///


        /// 初始化控件
        ///

        public MainPage()
        {
            InitializeComponent();

            StaticClass.ProgressBarStatic = stackProgress;
            StaticClass.UIRoot = LayoutRoot;
            StaticClass.UISB = storyboard;

            //初始化表单
            InitForm();
        }

        ///


        /// 初始化表单
        ///

        private void InitForm()
        {
            //设置“最外层滚动条”信息
            double browseWidth = Application.Current.Host.Content.ActualWidth;//SilverLight控件所在浏览器确定的宽度
            double browseHeight = Application.Current.Host.Content.ActualHeight;
            scrollOne.Width = browseWidth - 400;
            scrollOne.Height = browseHeight - 200;
         
            double width = browseWidth;
            double height = browseHeight;
            if (!Application.Current.IsRunningOutOfBrowser)//指示是否从浏览器外状态启动
            {
                //获取浏览器分辨率信息
                ScriptObject screen = (ScriptObject)HtmlPage.Window.GetProperty("screen");
                width = (double)screen.GetProperty("width");
                height = (double)screen.GetProperty("height");
            }

            if (NetworkInterface.GetIsNetworkAvailable())//指示是否有任何可用的网络连接
            {
              
            }


            //设置“滚动条”相关信息
            scrollTwo.Width = width - 200 - 10;
            scrollTwo.Height = height - 12;

            accOne.Height = height - 10;

            #region <<界面元素>>

            //“设备树”
            EquipmentTreeView entityTree = new EquipmentTreeView(stackThree);
            this.stackTree.Children.Add(entityTree);

            //“查询”
            SearchPanel entitySearch = new SearchPanel();
            this.stackSearch.Children.Add(entitySearch);

            //“手推车”
            HandCar entityHandCar = new HandCar();
            this.stackHandCar.Children.Add(entityHandCar);

            //“系统操作”
            //“全屏”
            FullScreenButton entityFullScreen = new FullScreenButton(scrollOne);
            this.stackSystem.Children.Add(entityFullScreen);

            //“回收站”
            Recyle entityRecyle = new Recyle();
            this.stackSystem.Children.Add(entityRecyle);

            //“模态窗口”
            Button btn = new Button();
            btn.Content = "回收站";
            btn.Click += new RoutedEventHandler(btn_Click);
            this.stackSystem.Children.Add(btn);

            //“ChildWindow”
            Button btnChildWindow = new Button();
            btnChildWindow.Content = "打开ChildWindow";
            btnChildWindow.Click += new RoutedEventHandler(btnChildWindow_Click);
            this.stackSystem.Children.Add(btnChildWindow);

            #endregion

            #region <<界面元素>>

            添加“设备树”按钮
            //Button btnComputerTree = new Button();
            //btnComputerTree.Content = "设备树";
            //btnComputerTree.Margin = new Thickness(0, 10, 0, 0);
            //btnComputerTree.Click += new RoutedEventHandler(btnComputerTree_Click);
            //stackOne.Children.Add(btnComputerTree);

            添加“全屏按钮”
            //FullScreenButton fb = new FullScreenButton(scrollOne);
            //fb.Margin = new Thickness(0, 10, 0, 0);
            //stackOne.Children.Add(fb);

            添加“查询”按钮
            //Button btnSearch = new Button();
            //btnSearch.Content = "查询";
            //btnSearch.Margin = new Thickness(0, 10, 0, 0);
            //btnSearch.Click += new RoutedEventHandler(btnSearch_Click);
            //stackOne.Children.Add(btnSearch);

            添加“手推车”按钮
            //Button btnCar = new Button();
            //btnCar.Content = "手推车";
            //btnCar.Margin = new Thickness(0, 10, 0, 0);
            //btnCar.Click += new RoutedEventHandler(btnCar_Click);
            //stackOne.Children.Add(btnCar);

            添加“回收站”按钮
            //Button btnRecyle = new Button();
            //btnRecyle.Content = "回收站";
            //btnRecyle.Margin = new Thickness(0, 10, 0, 0);
            //btnRecyle.Click += new RoutedEventHandler(btnRecyle_Click);
            //stackOne.Children.Add(btnRecyle);

            #endregion

            #region <<默认设置>>

            添加EquipmentTreeView
            //EquipmentTreeView entity = new EquipmentTreeView(stackThree);
            //this.stackTwo.Children.Add(entity);

            #endregion
        }

        private void btnChildWindow_Click(object sender, RoutedEventArgs e)
        {
            CWInRack cr = new CWInRack();
            cr.OverlayOpacity = 0.1;
            cr.Height = 300;
            cr.Width = 500;
            //cr.Content = tempFrame;
            try
            {
                cr.Show();
            }
            catch (Exception ex)
            {

            }
        }

        #endregion


        #region <<回收站相关>>

        ///


        /// “回收站”
        ///

        ///
        ///
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            //弹出“模态信息”窗口
            PopupService service = PopupService.GetServiceFor(LayoutRoot);
            MessagePageWdd box = service.GetMessagePageWdd(
                "置入回收站",
                 new RecyleContent(),
                "回收站",
                true,
                (MessageBoxButtonType)Enum.Parse(
                typeof(MessageBoxButtonType),
                "YesNo",
                true),
                MessageBoxIcon.Information
            );
            box.Effect = GDev.PopupBox.Effect.NoEffect(box);
            box.ShowComplete += new EventHandler(Box_ShowComplete);
            box.ButtonClick += new EventHandler(Box_ButtonClick);
            box.Show();

        }

        private void Box_ButtonClick(object sender, EventArgs e)
        {
            //MessageText.Text = "你点击了:" + ((MessagePage)sender).Result;
        }

        private void Box_ShowComplete(object sender, EventArgs e)
        {
            //MessageText.Text = "打开了新窗口";
        }

        #endregion

        #region <<控件事件>>

        ///


        /// “设备树按钮”点击事件
        ///

        ///
        ///
        private void btnComputerTree_Click(object sender, RoutedEventArgs e)
        {
            Type temp = this.stackTwo.Children[0].GetType();
            this.stackTwo.Children.Clear();

            //添加EquipmentTreeView
            EquipmentTreeView entity = new EquipmentTreeView(stackThree);
            this.stackTwo.Children.Add(entity);

            if (temp.Name == "EquipmentTreeView")
            {
                if (stackTwo.Visibility == Visibility.Collapsed)
                {
                    stackTwo.Visibility = Visibility.Visible;
                }
                else
                {
                    stackTwo.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                stackTwo.Visibility = Visibility.Visible;
            }
        }

        ///


        /// “查询按钮”点击事件
        ///

        ///
        ///
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            Type temp = this.stackTwo.Children[0].GetType();
            this.stackTwo.Children.Clear();

            //添加查询界面
            SearchPanel entity = new SearchPanel();
            this.stackTwo.Children.Add(entity);

            if (temp.Name == "SearchPanel")
            {
                if (stackTwo.Visibility == Visibility.Collapsed)
                {
                    stackTwo.Visibility = Visibility.Visible;
                }
                else
                {
                    stackTwo.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                stackTwo.Visibility = Visibility.Visible;
            }
        }

        ///


        /// “手推车”点击事件
        ///

        ///
        ///
        private void btnCar_Click(object sender, RoutedEventArgs e)
        {
            Type temp = this.stackTwo.Children[0].GetType();
            this.stackTwo.Children.Clear();

            //添加查询界面
            HandCar entity = new HandCar();
            this.stackTwo.Children.Add(entity);

            if (temp.Name == "HandCar")
            {
                if (stackTwo.Visibility == Visibility.Collapsed)
                {
                    stackTwo.Visibility = Visibility.Visible;
                }
                else
                {
                    stackTwo.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                stackTwo.Visibility = Visibility.Visible;
            }
        }

        ///


        /// “回收站”点击事件
        ///

        ///
        ///
        private void btnRecyle_Click(object sender, RoutedEventArgs e)
        {
            Type temp = this.stackTwo.Children[0].GetType();
            this.stackTwo.Children.Clear();

            //添加查询界面
            Recyle entity = new Recyle();
            this.stackTwo.Children.Add(entity);

            if (temp.Name == "Recyle")
            {
                if (stackTwo.Visibility == Visibility.Collapsed)
                {
                    stackTwo.Visibility = Visibility.Visible;
                }
                else
                {
                    stackTwo.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                stackTwo.Visibility = Visibility.Visible;
            }
        }

        #endregion

        #region <<辅助方法>>
        #endregion
    }
}

 

你可能感兴趣的:(MainPage.xaml_1121)