Esempio n. 1
0
        // runs only when not restored from state
        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            ConfigurationViewModel config = new ConfigurationViewModel();
            SettingsService.Instance.UseShellBackButton = true;

            // Ne rien mettre au dessus de ce code sinon Template10 fonctionne mal.
            NavigationService.Navigate(typeof(DashboardPage));

            if (config.Populated)
            {
                //Lancer le dispatchertimer
                var _dispatcher = new DispatcherTimer();
                _dispatcher.Interval = TimeSpan.FromMinutes(1);
                _dispatcher.Tick += _dispatcher_Tick;
                _dispatcher.Start();

                var taskFactory = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());

                // Tentative de connexion à Jeedom
                if (await RequestViewModel.Instance.PingJeedom() != null)
                {
                    ConnectDialog.ShowConnectDialog();
                    return;
                }

                await taskFactory.StartNew(async () =>
                {
                    await RequestViewModel.Instance.FirstLaunch();
                });
            }
            else
            {
                ConnectDialog.ShowConnectDialog();
            }

            await Task.CompletedTask;
        }
Esempio n. 2
0
 public ConnectViewModel()
 {
     Instance = this;
     _config = new ConfigurationViewModel();
 }
Esempio n. 3
0
        public async Task<bool> SendPosition(string position)
        {
            var config = new ConfigurationViewModel();
            var httpRpcClient = new HttpRpcClient("/core/api/jeeApi.php?api=" + config.ApiKey + "&type=geoloc&id=" + config.GeolocObjectId + "&value=" + position);

            return await httpRpcClient.SendRequest();
        }
Esempio n. 4
0
        public async Task<bool> SendNotificationUri(string uri)
        {
            var config = new ConfigurationViewModel();
            var httpRpcClient = new HttpRpcClient("/plugins/pushNotification/php/updatUri.php?api=" + config.ApiKey + "&id=" + config.NotificationObjectId + "&uri=" + uri);

            return await httpRpcClient.SendRequest();
        }