PgMain.xaml.cs 2.18 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
using FLY.Thick.Base.Server;
using FLY.Thick.Blowing360.Server;

using GalaSoft.MvvmLight.Command;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;

namespace FLY.Thick.Blowing360.UI.Server
{
    /// <summary>
    /// PgMain.xaml 的交互逻辑
    /// </summary>
    public partial class PgMain : Page
    {
        PgMainVm viewModel;
        public PgMain()
        {
            InitializeComponent();
        }
        public void Init(TDGage mGage) 
        {
            viewModel = new PgMainVm();
            viewModel.Init(mGage);
            this.DataContext = viewModel;
            
        }
    }
    public class PgMainVm : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public SysParam SysParam { get; set; }

        public FlyADBase.FlyAD7 FlyAd { get; set; }

        public RelayCommand SetupCmd { get; private set; }

        TDGage mGage;
        public PgMainVm()
        {
            SetupCmd = new RelayCommand(Setup);
        }



        public void Init(TDGage mGage)
        {
            this.mGage = mGage;
            SysParam = mGage.sysParam;
            FlyAd = mGage.flyAd;
        }

        private void Setup()
        {
            //打开设置页面

            WdSetup w = new WdSetup();
            w.Init(SysParam, FlyAd);
            w.Owner = App.Current.MainWindow;
            w.ShowDialog();
        }

    }

    public class ConnectionValueConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool? b = (bool?)value;
            if (b == null)
                return null;
            else if (b == true)
                return "连接成功";
            else
                return "连接断开";
        }

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