ComputerUnit.xaml_NEW

前伴唱

<UserControl xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="ComputerDropDragControl.ComputerUnit"
    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"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <toolkit:TwilightBlueTheme >
        <Grid x:Name="LayoutRoot" Background="White">
            <Button x:Name="btnComputer" Width="90" Height="23" VerticalAlignment="Top" HorizontalAlignment="Left" >
            </Button>
            <toolkit:ContextMenuService.ContextMenu>
                <toolkit:ContextMenu>
                    <toolkit:MenuItem Header="全屏" x:Name="miFudllScreen" Click="miFullScreen_Click"></toolkit:MenuItem>
                    <toolkit:MenuItem Header="告警"  x:Name="miNotify" Click="miNotify_Click"></toolkit:MenuItem>
                    <toolkit:MenuItem Header="回收站" x:Name="miRecycle" Click="miRecycle_Click"></toolkit:MenuItem>
                    <toolkit:MenuItem Header="手推车" x:Name="miShop" Click="miShop_Click"></toolkit:MenuItem>
                </toolkit:ContextMenu>
            </toolkit:ContextMenuService.ContextMenu>
        </Grid>
    </toolkit:TwilightBlueTheme>
</UserControl>

后半厂

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 System.Collections.ObjectModel;

namespace ComputerDropDragControl
{
    /// <summary>
    /// 设备单元
    /// 创建人:吴兆娟
    /// 创建时间:2011-10-26
    /// </summary>
    public partial class ComputerUnit : UserControl
    {
        #region <<页面加载>>

        /// <summary>
        /// 页面加载
        /// </summary>
        public ComputerUnit(NodeFrameView entity)
        {
            InitializeComponent();

            //btnComputer.Background = new SolidColorBrush(Color.FromArgb(255, 120, 183, 247));

            ReturnNodeFrameView = entity;

            //初始化表单
            InitForm();

        }

        TipWindow tipWindow = new TipWindow();

        private bool showTip;

        public bool ShowTip
        {
            get { return showTip; }
            set
            {
                showTip = value;
                if (showTip == true)
                {
                    tipWindow.BindControl(this.btnComputer, ReturnNodeFrameView);
                }
                else
                {
                    tipWindow.CancelBindControl(this.btnComputer);
                }
            }
        }

        /// <summary>
        /// “初始化表单”
        /// </summary>
        private void InitForm()
        {
            btnComputer.Height = (btnComputer.Height) * ReturnNodeFrameView.NodeSize;
            btnComputer.Content = ReturnNodeFrameView.NodeName;

            ReturnHeight = btnComputer.Height;
        }

        #endregion


        #region <<控件事件>>

        #region <<右键菜单相关事件>>

        /// <summary>
        /// “全屏”
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miFullScreen_Click(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// “告警”
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miNotify_Click(object sender, RoutedEventArgs e)
        {
            if (this.miNotify.Header.ToString() == "告警")
            {
                this.miNotify.Header = "取消告警";
                this.btnComputer.Background = new SolidColorBrush(Colors.Orange);

                //数据交互
            }
            else
            {
                this.miNotify.Header = "告警";
                this.btnComputer.ClearValue(BackgroundProperty);

                //数据交互
            }
        }

        /// <summary>
        /// “回收站”
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miRecycle_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("数据交互");
        }

        /// <summary>
        /// “手推车”
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miShop_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("数据交互");
        }

        #endregion

        #endregion

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

        public NodeFrameView ReturnNodeFrameView { get; set; }

        public UIElement UI;

        public ObservableCollection<NodeFrameView> NFList;

        public double ReturnHeight { get; set; }

    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值