Exemple #1
0
 public void ProcessData()
 {
     // Sumup Devices
     for (int index = 0; index < ReportLoaded; index++)
     {
         CrashData data    = CrashDataRaw[index];
         bool      isAdded = false;
         foreach (Device device in DevicesList)
         {
             if (device.DeviceBrand == data.DeviceBrand)
             {
                 if (device.DeviceName == data.DeviceName)
                 {
                     if (device.DeviceModel == data.DeviceModel)
                     {
                         isAdded = true;
                         device.CrashLogIndex.Add(index);
                         break;
                     }
                 }
             }
         }
         if (!isAdded) // Add this device to list
         {
             Device device = new Device(data.DeviceBrand, data.DeviceName, data.DeviceModel);
             device.CrashLogIndex.Add(index);
             DevicesList.Add(device);
         }
     }
 }
Exemple #2
0
 public User(int id, string name, GameObject avatar, DevicesList platform)
 {
     ID       = id;
     Name     = name;
     Avatar   = avatar;
     Platform = platform;
 }
 private void Quit_Click(object sender, EventArgs e)
 {
     BassAsio.BASS_ASIO_Free();
     Functions.SetDefaultDevice(AudioEngine.ASIO_ENGINE, 0, DevicesList.GetItemText(DevicesList.SelectedItem));
     Close();
     Dispose();
 }
        private void CheckDeviceExecute(object obj)
        {
            DeviceNode node = obj as DeviceNode;

            if (node == null)
            {
                return;
            }

            //Check the same item, keep it.
            if (node.IsChecked == false)
            {
                node.IsChecked = true;
                return;
            }
            SelectedDevice = node;
            //unchecked other menuitem
            DeviceNode checkedItem = DevicesList.FirstOrDefault(x => x.IsChecked == true && x != node);

            if (checkedItem != null)
            {
                checkedItem.IsChecked = false;
            }
            //Check current node
            CheckDeviceView(node);

            _document.IsDirty = true;
        }
 private void ButtonShow_Click(object sender, RoutedEventArgs e)
 {
     if (combobox.SelectedIndex == 0)
     {
         foreach (var device in Devices)
         {
             TimeSpan timeOfDay = device.RadniSati.TimeOfDay;
             int      hour      = timeOfDay.Hours;
             int      minute    = timeOfDay.Minutes;
             if (Int32.Parse(textBoxLimitSati.Text) < hour)
             {
                 DevicesList.Add(device);
             }
         }
     }
     else if (combobox.SelectedIndex == 1)
     {
         foreach (var device in Devices)
         {
             if (Int32.Parse(textBoxLimitPromene.Text) < device.BrPromjena)
             {
                 DevicesList.Add(device);
             }
         }
     }
 }
        private void OnStateChanged(object sender, object e)
        {
            switch (_viewModel.State)
            {
            case FlyoutViewState.Opening:
                var taskbar = WindowsTaskbar.Current;

                Show();
                PositionWindowRelativeToTaskbar(taskbar);

                // Focus the first device if available.
                DevicesList.FindVisualChild <DeviceView>()?.FocusAndRemoveFocusVisual();

                // Prevent showing stale adnorners.
                this.WaitForKeyboardVisuals(() =>
                {
                    LayoutRoot.Background = new SolidColorBrush(Themes.Manager.Current.ResolveRef(this, "AcrylicColor_Flyout"));
                    WindowAnimationLibrary.BeginFlyoutEntranceAnimation(this, taskbar, () =>
                    {
                        _viewModel.ChangeState(FlyoutViewState.Open);
                        // Wait to apply acrylic, or the translate transform illusion will be spoiled.
                        EnableAcrylicIfApplicable(taskbar);
                    });
                });
                break;

            case FlyoutViewState.Closing_Stage1:
                DevicesList.FindVisualChild <DeviceView>()?.FocusAndRemoveFocusVisual();

                if (_viewModel.IsExpandingOrCollapsing)
                {
                    AccentPolicyLibrary.DisableAcrylic(this);
                    WindowAnimationLibrary.BeginFlyoutExitanimation(this, () =>
                    {
                        this.Cloak();

                        // Go directly to ViewState.Hidden to avoid the stage 2 hide delay (debounce for tray clicks),
                        // we want to show again immediately.
                        _viewModel.ChangeState(FlyoutViewState.Hidden);
                    });
                }
                else
                {
                    // No animation for normal exit.
                    this.Cloak();
                    AccentPolicyLibrary.DisableAcrylic(this);

                    // Prevent de-queueing partially on show and showing stale adnorners.
                    this.WaitForKeyboardVisuals(() =>
                    {
                        Hide();
                        _viewModel.ChangeState(FlyoutViewState.Closing_Stage2);
                    });
                }
                break;
            }
        }
        private void ViewModel_OnStateChanged(object sender, object e)
        {
            switch (_viewModel.State)
            {
            case FlyoutViewModel.ViewState.Opening:
                if (_viewModel.ShowOptions == FlyoutShowOptions.Pointer)
                {
                    _rawListener.Start();
                }
                Show();

                // We need the theme to be updated on show because the window borders will be set based on taskbar position.
                ThemeChanged();
                UpdateWindowBounds();

                // Update layout otherwise we may display queued state changes
                UpdateLayout();
                DevicesList.Focus();

                WindowAnimationLibrary.BeginFlyoutEntranceAnimation(this, () => _viewModel.ChangeState(FlyoutViewModel.ViewState.Open));
                break;

            case FlyoutViewModel.ViewState.Closing_Stage1:
                _rawListener.Stop();

                if (_needsExpandOrCollapse)
                {
                    WindowAnimationLibrary.BeginFlyoutExitanimation(this, () =>
                    {
                        this.Cloak();
                        Hide();
                        // NB: Hidden to avoid the stage 2 hide delay, we want to show again immediately.
                        _viewModel.ChangeState(FlyoutViewModel.ViewState.Hidden);
                    });
                }
                else
                {
                    this.Cloak();
                    Hide();
                    DisableAcrylic();
                    _viewModel.ChangeState(FlyoutViewModel.ViewState.Closing_Stage2);
                }
                break;

            case FlyoutViewModel.ViewState.Hidden:
                if (_needsExpandOrCollapse)
                {
                    _needsExpandOrCollapse = false;

                    _viewModel.DoExpandCollapse();
                    _viewModel.BeginOpen();
                }
                break;
            }
        }
        /**<summary>鼠标点击数据表事件</summary>**/
        private void DevicesList_MouseDown(object sender, MouseButtonEventArgs e)
        {
            DevicesList.Focus();
            /* 获取鼠标点击的内容 */
            IInputElement CilckedControl = DevicesList.InputHitTest(e.GetPosition(DevicesList));

            /* 点击空白处则取消选中状态 */
            if (CilckedControl is ScrollViewer || CilckedControl is Border)
            {
                CancelSelect();
            }
        }
Exemple #9
0
 public ChoosePageViewModel(IDataService dataService)
 {
     this.dataService = dataService;
     dataService.GetDevicesCollections(
         (devicesCollections, error) =>
     {
         if (error != null)
         {
             // Report error here
             return;
         }
         foreach (var devicesCollection in devicesCollections)
         {
             DevicesList.Add(devicesCollection);
         }
     });
 }
Exemple #10
0
    public async Task ExecuteAsync(TextReader reader, byte systemType, ushort deviceType, byte hubId, byte portId, Version hw, Version sw)
    {
        var knowledge = _protocol.Knowledge;

        // override cached data
        using var disposable = _protocol.UpstreamRawMessages
                               .Subscribe(tuple => KnowledgeManager.ApplyStaticProtocolKnowledge(tuple.message, knowledge));

        await _protocol.ConnectAsync((SystemType)systemType); // registering to bluetooth notification

        if (systemType != 0)
        {
            Console.Error.WriteLine("Command Line provided Device Type, hubId, portId and versions hw/sw");
            await _mock.MockCharacteristic.AttachIO((DeviceType)deviceType, hubId, portId, hw, sw);
        }

        var foundSystemType = false;
        var foundAttachedIO = false;

        var line = await reader.ReadLineAsync();

        while (line is not null)
        {
            if (line.Substring(6, 8) == "01-0B-06") // property msg - systemtype - update
            {
                foundSystemType = true;
            }
            if (line.Substring(6, 2) == "04" && line.Substring(12, 2) == "01") // attached io msg (04) - port - attach event
            {
                foundAttachedIO = true;
            }
            await _mock.MockCharacteristic.WriteUpstreamAsync(line);

            line = await reader.ReadLineAsync();
        }

        if (systemType == 0 && (foundSystemType == false || foundAttachedIO == false))
        {
            Console.Error.WriteLine("#############################");
            Console.Error.WriteLine("SystemType and/or attached IO message not found in data or command line arguments");
            Console.Error.WriteLine("#############################");
        }

        DevicesList.PrettyPrintKnowledge(System.Console.Out, _protocol.Knowledge);
    }
        public void CheckDevices()
        {
            //_deviceModel.LoadDevices();

            DeviceNode selectedItem = DevicesList.FirstOrDefault(x => x.IsChecked == true);

            //Current select is null, select off item.
            if (selectedItem == null)
            {
                selectedItem = DevicesList.FirstOrDefault(x => x.Name == CommonDefine.PresetOff);
                if (selectedItem != null)
                {
                    selectedItem.IDevice.IsChecked = true;
                }
            }
            FirePropertyChanged("IsDeviceOn");
            CheckDeviceView(selectedItem);
        }
Exemple #12
0
        private void OpenComputersTable()//funkcja która otwiera tabelkę urządzeń
        {
            Computers computers = new Computers();

            computers.ShowDialog();                // nie można kożystać z głównego okna puki to jest otwarty (Dialog)
            using (var db = new PingDataContext()) // wyczyszczenie i wpisanie danych na nowo (można w tym oknie usuwać dane więc po zamknięciu trzeba zaktualizować)
            {
                DevicesIP.Clear();
                IdControl.Clear();
                DevicesList.Clear();
                var devicesAll = db.Devices.ToList();
                foreach (var item in devicesAll)
                {
                    DevicesIP.Add(item.IP);
                    IdControl.Add(item.Id);
                    DevicesList.Add(item.Name + " " + item.IP);
                }
            }
        }
        private void OnStateChanged(object sender, object e)
        {
            switch (_viewModel.State)
            {
            case FlyoutViewModel.ViewState.Opening:
                Show();
                ThemeChanged();
                UpdateWindowBounds();

                // Focus the first device if available.
                DevicesList.FindVisualChild <DeviceView>()?.FocusAndRemoveFocusVisual();

                WaitForKeyboardVisuals(() =>
                {
                    WindowAnimationLibrary.BeginFlyoutEntranceAnimation(this, () => _viewModel.ChangeState(FlyoutViewModel.ViewState.Open));
                });
                break;

            case FlyoutViewModel.ViewState.Closing_Stage1:
                DevicesList.FindVisualChild <DeviceView>()?.FocusAndRemoveFocusVisual();

                if (_viewModel.IsExpandingOrCollapsing)
                {
                    WindowAnimationLibrary.BeginFlyoutExitanimation(this, () =>
                    {
                        this.Cloak();
                        // NB: Hidden to avoid the stage 2 hide delay, we want to show again immediately.
                        _viewModel.ChangeState(FlyoutViewModel.ViewState.Hidden);
                    });
                }
                else
                {
                    this.Cloak();
                    DisableAcrylic();
                    WaitForKeyboardVisuals(() =>
                    {
                        Hide();
                        _viewModel.ChangeState(FlyoutViewModel.ViewState.Closing_Stage2);
                    });
                }
                break;
            }
        }
        public async void SearchDevices()
        {
            CheckScanningStatus();
            DevicesList.Clear();

            Adapter.ScanTimeout = Constants.SCAN_TIMEOUT;
            Adapter.ScanMode    = ScanMode.Balanced;

            Adapter.DeviceDiscovered += (s, a) =>
            {
                var device = a.Device;

                if (!DevicesList.Contains(device) && device.Name != null)
                {
                    DevicesList.Add(device);
                }
            };

            await Adapter.StartScanningForDevicesAsync();
        }
Exemple #15
0
 public MainWindowViewModel()                                          //ustawienie początkowych wartości elementów
 {
     OpenComputersTableCommand = new RelayCommand(OpenComputersTable); //stworzenie relaycommand tak by można było przypiosać funkcje do elementów okna (naciśnięcie przycisku itp.
     OpenResponsesTableCommand = new RelayCommand(OpenResponsesTable);
     AddDeviceCommand          = new RelayCommand(AddDevice);
     PingCommand = new RelayCommand(PingDevice);
     CanPing     = false;
     CanAdd      = false;
     using (var db = new PingDataContext())    // operowanie na bazie
     {
         db.Database.CreateIfNotExists();      // stworzenie bazy jeśli nie istnieje
         var devicesAll = db.Devices.ToList(); // wpisanie wszyskich urządzeń do listy by potem poszczególne elementy dodać do właściwości ViewModelu
         foreach (var item in devicesAll)
         {
             DevicesIP.Add(item.IP);
             IdControl.Add(item.Id);
             DevicesList.Add(item.Name + " " + item.IP);
         }
     }
 }
Exemple #16
0
        private void AddDevice() // dodawanie urządzenia
        {
            using (var db = new PingDataContext())
            {
                db.Devices.Add(new Devices()
                {
                    IP          = _IPAddress,
                    Name        = _Name,
                    Description = _Description
                });

                db.SaveChanges();
                DevicesList.Add(_Name + " " + _IPAddress);    //dodanie nowego urządzenia do listy
                DevicesIP.Add(_IPAddress);                    //dodanie ip
                IdControl.Add(db.Devices.ToList().Last().Id); //dodanie id nowego elementu (bierze ostatnie id z bazy - to dodane)
                Name        = "";
                IPAddress   = "";
                Description = "";
            }
        }
Exemple #17
0
        public async Task GetDevices()
        {
            DeviceScanning = true;

            DevicesList.Clear();
            try
            {
                var list = await DependencyService.Get <IBLEAdapter>().ScanForDevicesAsync();

                foreach (var device in list)
                {
                    DevicesList.Add(device);
                }
            }
            catch (Exception ey)
            {
            }


            DeviceScanning = false;
        }
 public IDevice GetDevice(Func <IDevice, bool> searchFunc) => DevicesList.FirstOrDefault(searchFunc);
 private void SetConfigToStandalone()
 {
     device = DevicesList.Standalone;
     configOnStandalone.Invoke();
 }
 private void SetConfigToWindowsVive()
 {
     device = DevicesList.HTCVive;
     configOnWindowsVive.Invoke();
 }
 private void SetConfigToWindowsRift()
 {
     device = DevicesList.OculusRift;
     configOnWindowsRift.Invoke();
 }
 private void SetConfigToQuest()
 {
     Debug.Log("aljkfhsfgilug");
     device = DevicesList.OculusQuest;
     configOnQuest.Invoke();
 }
 private void SetConfigToAndroid()
 {
     device = DevicesList.Android;
     configOnAndroid.Invoke();
 }
 public IEnumerable <IDevice> SearchDevices(Func <IDevice, bool> searchFunc) => DevicesList.Where(searchFunc);
Exemple #25
0
 public Broker()
 {
     Publishers  = new DevicesList();
     Subscribers = new SubscribersList();
 }
 public void AddDevice(IDevice device) => DevicesList.Add(device);