Пример #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }

            if (Frame.CanGoBack)
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            else
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            eqLogic = e.Parameter as EqLogic;
            ActionList = eqLogic.GetActionsCmds();
            InformationList = eqLogic.GetInformationsCmds();
            EqLogicName = eqLogic.name;
            if (ActionList.Count == 0)
                actionview.Visibility = Visibility.Collapsed;

            if (InformationList.Count == 0)
                infoview.Visibility = Visibility.Collapsed;

            var taskFactory = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());
            await taskFactory.StartNew(() => DoWork(tokenSource), tokenSource.Token);

            base.OnNavigatedTo(e);
        }
Пример #2
0
 /// <summary>
 /// Renvoie vrai si l'équipement a les commandes recherchées
 /// </summary>
 /// <param name="eq">L'équipement Jeedom</param>
 /// <param name="types">Les generic_type recherchés</param>
 /// <returns></returns>
 private static bool ContainCmd(EqLogic eq, string[] types)
 {
     int _find = 0;
     foreach (var type in types)
     {
         if (eq.cmds != null)
         {
             var search = eq.cmds.Where(c => c.display.generic_type == type);
             if (search.Count() > 0)
                 _find += 1;
         }
     }
     return _find == types.Count();
 }
Пример #3
0
 public async Task UpdateEqLogic(EqLogic eq)
 {
     var infoCmds = from cmd in eq.cmds where cmd.type == "info" select cmd;
     foreach (Command cmd in infoCmds)
     {
         if (!cmd.Updating)
         {
             await ExecuteCommand(cmd);
             cmd.datetime = _dateTime;
         }
     }
 }