Exemple #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Start default stuff
            ViewModel = new Form1ViewModel();
            PLCClient.Get().sendString("P"); //Init singleton
            SCADAForm = new Form1(ViewModel);
            var LifetimeThread = new ImAlive();


            //Run Main
            //Application.Run(SCADAForm);
            SCADAForm.ShowDialog();
            LifetimeThread.UptimeThread.Abort();
        }
        public Form1(Form1ViewModel vM)
        {
            InitializeComponent();



            //Cell status binding
            Status.DataBindings.Add("Text", vM, "status");
            Uptime.DataBindings.Add("Text", vM, "Uptime", true, DataSourceUpdateMode.OnPropertyChanged, new TimeSpan(0, 0, 0), @"hh\:mm\:ss");
            //Info.DataBindings.Add("Text", vM, "Info");

            Order.DataBindings.Add("Text", vM, "CurrentOrder.id");
            Ticket.DataBindings.Add("Text", vM, "CurrentOrderKey");
            Blue.DataBindings.Add("Text", vM, "CurrentOrder.blue");
            Red.DataBindings.Add("Text", vM, "CurrentOrder.red");
            Yellow.DataBindings.Add("Text", vM, "CurrentOrder.yellow");
            Time.DataBindings.Add("Text", vM, "OrderTimeStr");

            OEE_Availability.DataBindings.Add("Text", vM, "RunTime", true, DataSourceUpdateMode.OnPropertyChanged, new TimeSpan(0, 0, 0), @"hh\:mm\:ss");
            OEE_Availability_Proc.DataBindings.Add("Text", vM, "OEE_Availability_Proc_str");
            OEE_Performance.DataBindings.Add("Text", vM, "OEE_Performance_Str");
            OEE_Performance_Proc.DataBindings.Add("Text", vM, "OEE_Performance_Proc_str");
            OEE_Quality.DataBindings.Add("Text", vM, "OEE_Quality");
            OEE_Quality_Proc.DataBindings.Add("Text", vM, "OEE_Quality_Proc_str");
            OEE_PROC.DataBindings.Add("Text", vM, "OEE_Proc");

            Start.DataBindings.Add("Enabled", vM, "EnableStart");
            Hold.DataBindings.Add("Enabled", vM, "EnableHold");
            Clear.DataBindings.Add("Enabled", vM, "EnableClearing");



            Log.DataBindings.Add("Text", vM, "log");

            dataGridView1.DataSource        = vM.AllOrdersDone;
            dataGridView1.CellValueChanged += CellValueChangeEventHandler;

            OrderPoints.DataBindings.Add("Text", vM, "Points");

            //dataGridView1.DataBindings.Add("DataMember", vM, "AllOrdersDone");


            //this.ViewModelBindingSource.DataSource = viewmodel;
            //this.InitializeDataBindings();
        }