public AppViewModel()
        {
            Cameras = new ObservableCollection <CameraViewModel>();

            PushNotifications.RemoveOldChannel("com.davux.FoscamController3");
            PushNotifications.OnToastNotification += (title, msg) =>
            {
                Debug.WriteLine("Toast: " + msg);
            };
            PushNotifications.ErrorOccurred += msg => MessageBox.Show("Push Notification error: " + msg);
            PushNotifications.ChannelName    = "com.davux.FoscamController";
            PushNotifications.Initialize();
            PushNotifications.TryEnableOnce();

            var SavedConfig = Settings.Get <List <CameraObject> >("cams", null);

            if (SavedConfig == null)
            {
                var NewConfig = new List <CameraObject>();
                NewConfig.Add(new CameraObject
                {
                    URL      = "http://example.com",
                    Title    = "Dave-Home",
                    Timezone = "America/New_york",
                    Password = "******",
                    Username = "******",
                    Version  = CameraObject.CameraVersion.FI8918W,
                });
                NewConfig.Add(new CameraObject
                {
                    URL      = "http://example.com:8080",
                    Title    = "Other",
                    Timezone = "America/Los_Angeles",
                    Username = "******",
                    Password = "******",
                    Version  = CameraObject.CameraVersion.FI8918W,
                });

                Settings.Set("cams", NewConfig);
                SavedConfig = Settings.Get <List <CameraObject> >("cams", null);
            }

            if (SavedConfig == null)
            {
                // Cameras.Add(new CameraViewModel { Title = "TEST", });
            }
            else
            {
                foreach (var config in SavedConfig)
                {
                    Cameras.Add(new CameraViewModel(config));
                }
            }

            Timezones = new List <string> {
                "America/New_York",
                "America/Los_Angeles"
            };
        }
Beispiel #2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();

            LoadApplication(new App());

            PushNotifications.Initialize(options);
            Client.OS.AppleMailBackup.Initialize(this, options);

            return(base.FinishedLaunching(app, options));
        }