void Start()
 {
     if (GameObject.FindGameObjectWithTag("MonitorLevel") != null)
     {
         monitorControl = GameObject.FindGameObjectWithTag("MonitorLevel").GetComponent <MonitorControl>();
     }
 }
示例#2
0
        private static void InitializeMonitorControls()
        {
            if (VmManager.Instance.RunningGroupIndex != -1)
            {
                _monitorView.lblBindingPhoneNumsValue.Text   = $"{SocketServer.AllConnectionKey.Values.Count}";
                _monitorView.lblConnectedPhoneNumsValue.Text = $"{DeviceConnectionManager.Instance.Devices.Length}";

                int RunningVmCount = VmManager.Instance.GetRunningCount();

                bool useCachedMonitors = false;
                if (_monitors.Count == RunningVmCount)
                {
                    useCachedMonitors = true;
                }
                else
                {
                    _monitors.Clear();
                    _monitorView.monitorContainer.Children.Clear();
                }

                for (int i = 0; i < VmManager.Instance.Column; i++)
                {
                    int index = VmManager.Instance.VmIndexArray[VmManager.Instance.RunningGroupIndex, i];

                    if (index != -1)
                    {
                        bool connected = SocketServer.AllConnectionKey.Values.Any(session => session.MobileIndex == index);


                        if (useCachedMonitors)
                        {
                            //_monitors[i].lblConnectionStatus.Background = connected ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red);
                            _monitors[i].imgConnectionStatus.Source = connected ? new BitmapImage(new Uri("../Images/红.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("../Images/灰.png", UriKind.RelativeOrAbsolute));
                            _monitors[i].lblPhoneId.Text            = $"{index + 1}";
                            _monitors[i].lblPhoneNickName.Text      = DeviceConnectionManager.Instance.GetDeviceNameByMobileIndex(index);

                            if (_monitors[i].Parent == null)
                            {
                                _monitorView.monitorContainer.Children.Add(_monitors[i]);
                            }
                        }
                        else
                        {
                            MonitorControl monitorControl = new MonitorControl()
                            {
                                //lblConnectionStatus = { Background = connected ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red) },
                                imgConnectionStatus = { Source = connected ? new BitmapImage(new Uri("../Images/红.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("../Images/灰.png", UriKind.RelativeOrAbsolute)) },
                                lblPhoneId          = { Text = $"{index + 1}" },
                                lblPhoneNickName    = { Text = DeviceConnectionManager.Instance.GetDeviceNameByMobileIndex(index), },
                            };

                            _monitors.Add(monitorControl);
                            _monitorView.monitorContainer.Children.Add(monitorControl);
                        }
                    }
                }
            }
        }
示例#3
0
        public MainWindowViewModel(IMainView view, KeyControl keyControl, MonitorControl monitorControl)
        {
            View           = view;
            KeyControl     = keyControl;
            MonitorControl = monitorControl;

            // modify..
            var monitorViewModel = (MonitorViewModel)MonitorControl.DataContext;

            monitorViewModel.SetKeyViewModel((KeyViewModel)KeyControl.DataContext);
            SetupKeys();
        }
示例#4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Turning off monitor in 5 seconds...");
            Thread.Sleep(5000);
            // NativeMethods.SetSuspendState(false, true, false); // This will log off user

            MonitorControl.SetMonitorInState(MonitorControl.MonitorState.MonitorStateStandBy);


            Console.WriteLine("Waiting for computer to wake up for a minute");
            WakeUpTimer.SetWaitForWakeUpTime(1);
            Console.WriteLine("Wake Up the computer- turn the monitor on");
            MonitorControl.WakeUp();
            Console.WriteLine("computer awake - monitor was turned on successfully if you can read this");
            Console.ReadLine();
        }
    public void RunIsClicked()
    {
        if (GameObject.FindGameObjectWithTag("MonitorLevel") == null)
        {
            Debug.Log("No MonitorLevel in scene!");
            return;
        }

        MonitorControl mc    = GameObject.FindGameObjectWithTag("MonitorLevel").GetComponent <MonitorControl>();
        bool           value = mc.VerifyValues();

        if (value == false)
        {
            return;
        }

        BlanketControl bc = GameObject.FindGameObjectWithTag("MonitorLevel").GetComponent <BlanketControl>();

        value = bc.AllBlanketHasSheet();
        if (value == false)
        {
            Debug.Log("Blanket Does not have any sheets");
            return;
        }


        if (!ButtonIsActive)
        {
            _frontOperation.SetRunTrue();
            Debug.Log("Operation Buttons: ButtonIsActive true");
            ButtonIsActive = true;
        }
        else
        {
            _frontOperation.SetRunFalse();
            ButtonIsActive = false;
            Debug.Log("Operation Buttons: ButtonIsActive false");
        }
    }