예제 #1
0
파일: App.xaml.cs 프로젝트: phabrys/Domojee
        // 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;
        }
예제 #2
0
 public ConnectViewModel()
 {
     Instance = this;
     _config = new ConfigurationViewModel();
 }
예제 #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();
        }
예제 #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();
        }