DynAreaBlowing.xaml.cs 4 KB
Newer Older
1 2
using FLY.Thick.Base.IService;
using FLY.Thick.Blowing.IService;
3
using MathNet.Numerics;
4 5
using MultiLayout;
using MultiLayout.UiModule;
6 7 8
using System;
using System.ComponentModel;
using System.Globalization;
9 10
using System.Windows;
using System.Windows.Controls;
11
using System.Windows.Data;
12 13 14 15 16 17 18 19 20 21
using System.Windows.Navigation;
using Unity;

namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
    /// <summary>
    /// DynAreaBlowing.xaml 的交互逻辑
    /// </summary>
    public partial class DynAreaBlowing : UserControl
    {
22 23
        //IBlowingFixService blowingFixService;
        //IBlowingDetectService blowingDetectService;
24 25 26 27 28 29 30 31 32
        IUnityContainer container;
        public DynAreaBlowing()
        {
            InitializeComponent();
        }

        [InjectionMethod]
        public void Init(
            IUnityContainer container,
33
            //IBlowingService blowingFixService,
34 35 36
            IBlowingDetectService blowingDetectService)
        {
            this.container = container;
37
            
38 39 40 41 42 43
            //this.blowingFixService = (IBlowingFixService)blowingFixService;
            //this.blowingDetectService = blowingDetectService;
            this.DataContext = blowingDetectService;
            //Border_Blowing.DataContext = blowingFixService;
            //border_bDetect.DataContext = blowingDetectService;
            //Border_Width.DataContext = blowingDetectService;
44 45 46 47 48 49 50 51
        }

        private void Border_Blowing_Click(object sender, RoutedEventArgs e)
        {
            var p = container.Resolve<PgBlowing>();
            MultiLayout.FlyLayoutManager.NavigationService.Navigate(p);
        }
    }
52 53 54 55 56 57 58
    public class DynAreaBlowingVmUt : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public double Angle { get; set; } = -170.2;
        public Misc.DIRECTION Direction { get; set; } = Misc.DIRECTION.FORWARD;
        public TimeSpan RenZiJiaPeriod { get; set; } = TimeSpan.FromMinutes(12.3);
        public TimeSpan PastTime { get; set; } = TimeSpan.FromMinutes(3.3);
59

60 61
        public double FilmVelocity { get; set; } = 50.1;
    }
62 63 64 65 66 67
    public class UiModule2_DynAreaBlowing : MultiLayout.UiModule.IUiModule2
    {
        /// <summary>
        /// 控件标题
        /// 它的值取决于culture
        /// </summary>
68
        public string Title => "测厚.吹膜状态";
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
        public ComponentType Type => ComponentType.DynArea;
        public bool IsUnique => true;

        /// <summary>
        /// 控件
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FrameworkElement GetComponent(int id, IUnityContainer container)
        {
            return container.Resolve<DynAreaBlowing>();
        }

        /// <summary>
        /// 控件缩略图,用于编辑界面时,大致看看
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FrameworkElement GetThumbnail()
        {
            return new System.Windows.Controls.Grid();
        }


        /// <summary>
        /// 给出全部控件ID, 控件自行删除没有的参数
        /// </summary>
        /// <param name="IDs"></param>
        public void MatchParam(int[] IDs)
        {

        }
    }
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130

    public class Angle2CWConverter : IValueConverter
    {

        #region IValueConverter 成员

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(value is double)
                && !(value is int)
                ) {
                return null;
            }

            int angle = System.Convert.ToInt32(value);
            return -angle;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }


        #endregion
    }

131
}