Наследование: IApplicationData
Пример #1
0
        void DumpPlayReadySettings()
        {
            TestLogger.LogMessage("Dumping PlayReadySettings...");

            Windows.Storage.ApplicationData appData = Windows.Storage.ApplicationData.Current;

            Windows.Storage.StorageFolder storageFolder = appData.LocalFolder;
            TestLogger.LogMessage("AppData LocalFolder Path = " + storageFolder.Path);

            IReadOnlyDictionary <string, ApplicationDataContainer> dictionary = appData.LocalSettings.Containers;

            TestLogger.LogMessage("Container count = " + dictionary.Count);
            foreach (string containerName in dictionary.Keys)
            {
                TestLogger.LogMessage("Container name = " + containerName);
            }

            Windows.Storage.ApplicationDataContainer playreadySettings = appData.LocalSettings.Containers["PlayReady"];

            TestLogger.LogMessage("Settings container Name = " + playreadySettings.Name);
            Windows.Foundation.Collections.IPropertySet propertySetValues = playreadySettings.Values;
            foreach (string strKey in propertySetValues.Keys)
            {
                string strValue = propertySetValues[strKey].ToString();
                TestLogger.LogMessage("Key     = " + strKey);
                TestLogger.LogMessage("Value   = " + strValue);
            }
        }
 async void DataChangedHandler(ApplicationData appData, object o)
 {
     // DataChangeHandler may be invoked on a background thread, so use the Dispatcher to invoke the UI-related code on the UI thread.
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         DisplayOutput();
     });
 }
Пример #3
0
 private void SettingsChanged(Windows.Storage.ApplicationData sender, object args)
 {
     RaisePropertyChanged(nameof(WordWrap));
     RaisePropertyChanged(nameof(FontFamily));
     RaisePropertyChanged(nameof(FontSize));
     RaisePropertyChanged(nameof(UseSoftTab));
     RaisePropertyChanged(nameof(TabSize));
 }
 async void DataChangedHandler(Windows.Storage.ApplicationData appData, object o)
 {
     // DataChangeHandler may be invoked on a background thread, so use the Dispatcher to invoke the UI-related code on the UI thread.
     await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         DisplayOutput();
     });
 }
        public SetVersion()
        {
            this.InitializeComponent();

            appData = ApplicationData.Current;

            DisplayOutput();
        }
        /// <summary>
        /// Roaming app data change handler
        /// </summary>
        /// <param name="appData"></param>
        /// <param name="o"></param>
        void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
        {
            ApplicationDataContainer roamingSettings = appData.RoamingSettings;

            current_state.access_token  = (string)roamingSettings.Values["access_token"];
            current_state.refresh_token = (string)roamingSettings.Values["refresh_token"];
            current_state.expire_time   = DateTime.Parse((string)roamingSettings.Values["expire_time"]);
            current_state.logged_in     = (bool)roamingSettings.Values["logged_in"];
        }
        public DataChangedEvent()
        {
            this.InitializeComponent();

            applicationData = ApplicationData.Current;
            roamingSettings = applicationData.RoamingSettings;

            DisplayOutput();
        }
        public HighPriority()
        {
            this.InitializeComponent();

            applicationData = ApplicationData.Current;
            roamingSettings = applicationData.RoamingSettings;
            
            DisplayOutput(false);
        }
 /// <summary>
 /// Event triggered when an ApplicationData's RoamingSettings are changed (gets changed in the SettingsOptionsContext page
 /// which is part of the Settings flyout)
 /// </summary>
 async void Current_DataChanged(ApplicationData sender, object args) 
 { 
      // DataChangeHandler may be invoked on a background thread, so use the Dispatcher to invoke the UI-related code on the
     // UI thread. 
     await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         // Cause the web browser to reload in its content
         UpdateURI();
     });
 }
Пример #10
0
        public static IEnumerable<string> GetChannelsOrDefault(ApplicationData data = null)
        {
            if (data == null)
                data = ApplicationData.Current;

            var channels = data.RoamingSettings.Values["Channels"] as string;

            if (string.IsNullOrWhiteSpace(channels))
                return new List<string> { "10","11","9","12","299","15","21","156" };

            return channels.ToObject<ChannelGroup>().ChannelIds;
        }
Пример #11
0
        public static IEnumerable<string> GetFavoritesOrDefault(ApplicationData data = null)
        {
            if (data == null)
                data = ApplicationData.Current;

            var favorites = data.RoamingSettings.Values["Favorites"] as string;

            if (string.IsNullOrWhiteSpace(favorites))
                return new List<string>();

            return favorites.ToObject<FavoriteGroup>().Favorites;
        }
Пример #12
0
        async void DataChangedHandler(Windows.Storage.ApplicationData sender, object args)
        {
            // DataChangeHandler may be invoked on a background thread,
            // so use the Dispatcher to invoke the UI-related code on the UI thread.
            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                var roamingSettings         = Windows.Storage.ApplicationData.Current.RoamingSettings;
                DateTime lastSuspensionTime = Convert.ToDateTime(
                    roamingSettings.Values["lastRoamingSettingDate"].ToString());

                DataChangedInvoked.Text = "Yes";
            });
        }
Пример #13
0
 private void InitializeApplicationSettingsSections()
 {
     applicationData = ApplicationData.Current;
     localSettings = applicationData.LocalSettings;
     if (localSettings.Values["Credentials"] == null)
     {
         credentials = new Windows.Storage.ApplicationDataCompositeValue();
     }
     else
     {
         credentials = (ApplicationDataCompositeValue)localSettings.Values["Credentials"];
     }
 }
Пример #14
0
 private static async void CurrentOnDataChanged(ApplicationData sender, object args)
 {
     try
     {
         await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             if (DataChanged != null)
             {
                 DataChanged(args, null);
             }
         });
     }
     catch (Exception ex)
     {
         if (DataChanged != null)
         {
             DataChanged(null, ex);
         }
     }
 }
Пример #15
0
        async void Current_DataChanged(ApplicationData sender, object args)
        {
            if (viewModel != null)
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
                {
                    var channels = App.GetChannelsOrDefault(sender);
                    var changed = CheckIfChanged(channels);

                    if (changed)
                    {
                        viewModel.Channels = channels;
                        await LoadChannels();
                    }
                    else
                    {
                        UpdateFavorites();
                    }
                });
            }
        }
Пример #16
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            appData = ApplicationData.Current;
            Object value = appData.LocalSettings.Values["scannerInterval"];
            if (value == null)
            {
                // No data
                System.Diagnostics.Debug.WriteLine("Null");
                button_scanner_interval = 5;
                appData.LocalSettings.Values["scannerInterval"] = button_scanner_interval;
            }
            else
            {
                button_scanner_interval = (int)value;
            }
            deviceController = new DeviceManager();
            bm.connectToDefault(null, null);

            time.Interval = TimeSpan.FromSeconds(15);
            time.Tick += checkConnection;
            time.Start();
        }
Пример #17
0
 private void Current_DataChanged(ApplicationData sender, object args)
 {
     //is this only for a roaming change?
 }
Пример #18
0
 private static void DataChangeHandler(ApplicationData data, object o)
 {
     // Refresh data here!
     LoadData();
 }
Пример #19
0
        //TODO: Fix this to actually update lists in the various views somehow. Maybe each view should be responsible for subscribing to it?
        private async void OnRoamingDataChanged(ApplicationData sender, object args)
        {
            using (await f_lock.Acquire())
            {
                foreach (var file in _localFiles)
                {
                    if (file.IsRoamed)
                    {
                        await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                            () => _localFiles.Remove(file));
                    }
                }


                var roamingFiles = await sender.RoamingFolder.GetFilesAsync();
                foreach (var file in roamingFiles.Where(f => f.Name != Constants.IV_FILE_NAME))
                {
                    BindableStorageFile bsf = await BindableStorageFile.Create(file);
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                        () => _localFiles.Add(bsf));
                }
            }
        }                
Пример #20
0
 async void onDataChanged(Windows.Storage.ApplicationData sender, object args) => await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => tbRoamDataChd.Text = $"{DateTime.Now:ddd HH:mm:ss}  {DevOp.MachineName}  {args}\r\n" + tbRoamDataChd.Text);
        private async void LoadSavedGame(ApplicationData appData)
        {
            try
            {
                CurrentGame = await StorageHelper.GetObjectFromRoamingFolder<Game>(appData, STR_Gamejson);
                CurrentGame.OnFailure += _game_OnFailure;
                CurrentGame.OnVictory += _game_OnVictory;
                Moves.Clear();
                var moves = await StorageHelper.GetObjectFromRoamingFolder<ObservableCollection<PlayerMoveViewModel>>(appData, STR_Movesjson);
                foreach (var move in moves)
                {
                    Moves.Add(move);
                }
                MoveSlotOne = StorageHelper.GetObjectFromSetting<string>(appData, "MoveSlotOne");
                MoveSlotTwo = StorageHelper.GetObjectFromSetting<string>(appData, "MoveSlotTwo");
                MoveSlotThree = StorageHelper.GetObjectFromSetting<string>(appData, "MoveSlotThree");
                MoveSlotFour = StorageHelper.GetObjectFromSetting<string>(appData, "MoveSlotFour");
                SolutionVisibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                // show error message
                ClearSavedGameState();
                Messenger.Default.Send<ErrorLoadingGameMessage>(new ErrorLoadingGameMessage(ex));

                // start new game
                StartNewGame();
            }
        }
 private void DataChangeHandler(ApplicationData appData, object o)
 {
     // TODO: Make a decision here to load the saved game data or not based on some rules. For now, just load it if you find it.
     LoadSavedGame(appData);
 }
Пример #23
0
 public void Current_DataChanged(ApplicationData sender, object args)
 {
     Debug.WriteLine("Roaming data is veranderd");
 }
Пример #24
0
            public SharedPreferencesPropertySet()
            {
#pragma warning disable 618
                _preferences = PreferenceManager.GetDefaultSharedPreferences(ApplicationData.GetAndroidAppContext());
#pragma warning restore 618
            }
Пример #25
0
        public void RefreshData(ApplicationData freshData)
        {
            var roamingSettings = freshData.RoamingSettings;
            // roamingSettings.Values["profile"] = composite;

            //check if there is already a profile
            if (roamingSettings.Values.ContainsKey("profile"))
            {
                var composite = roamingSettings.Values["profile"] as ApplicationDataCompositeValue;
                if (composite != null)
                {
                    if (composite.ContainsKey("recitatorId"))
                    {
                        var selected = composite["recitatorId"] as int?;
                        if (selected != null)
                        {
                            RecitatorId = selected.Value;
                        }
                    } 
                }
            }
            SaveProfile(RecitatorId);
        }
Пример #26
0
 private void RoamingDataChangeHandler(Windows.Storage.ApplicationData appData, object o)
 {
     NotificationsManager.UpdateTaskNotifications();
 }
Пример #27
0
 private void applicationData_DataChanged(ApplicationData sender, object args)
 {
     Debug.WriteLine("DataChanged");
 }
Пример #28
0
 partial void InitializePartial(ApplicationData owner)
 {
     Values = new NSUserDefaultsPropertySet();
 }
Пример #29
0
 partial void InitializePartial(ApplicationData owner)
 {
     Values = new FilePropertySet(owner, Locality);
 }
 private void Current_DataChanged(ApplicationData sender, object args)
 {
     ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;
     var ac = roamingSettings.Values["AutoConnect"];
     AutoConnect = (ac == null) ? false : true;
 }
Пример #31
0
 /// <summary>
 /// Creates a new instance of <see cref="WinRTFileSystem"/>
 /// </summary>
 public WinRTFileSystem()
 {
     _applicationData = ApplicationData.Current;
 }
Пример #32
0
 private void DataChangeHandler(Windows.Storage.ApplicationData appData, object someObject)
 {
     // Refresh local data here.
 }
Пример #33
0
 private async void DataChangedHandler(ApplicationData sender, object args)
 {
     Debug.WriteLine("Data changed!");
     await this.Dispatcher.DispatchAsync(async () =>
     {
         if (timer != null && timer.IsEnabled)
         {
             timer.Stop();
         }
         await App.AccountsModel.ReadChanged();
     });
 }
Пример #34
0
 private void DataChangeHandler(ApplicationData appData, object o)
 {
     ReloadItems();
 }
Пример #35
0
 public void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
 {
     // TODO: Refresh your data
 }
Пример #36
0
        private async void OnDataChanged(ApplicationData sender, object args)
        {
            string message = "Application data " + sender.Version + " synchronized on " + DateTime.Now;
            string title = "Roaming Application Data Synchronized";

            // When data changes. Settings should be unloaded/loaded so websites get synchronized.
            SettingsManager.Unload();
            SettingsManager.Load();

            // Also unload and load read-list.
            ReadListManager.Unload();

            // When data changes, the read-list may contain new read-questions.
            await QuestionsManager.RemoveReadQuestionsUpdateTileAndBadgeAndSaveAsync();

            HandleTaskCompletedOrDataChanged(message, title);
        }
Пример #37
0
 /// <summary>
 /// Creates a new instance of <see cref="WinRTFileSystem"/>
 /// </summary>
 public WinRTFileSystem()
 {
     _applicationData = ApplicationData.Current;
 }
Пример #38
0
 private void AppDataOnDataChanged(ApplicationData sender, object args)
 {
     var content = new ToastContent()
     {
         Visual = new ToastVisual()
         {
             TitleText = new ToastText() { Text = "Selfwin" },
             BodyTextLine1 = new ToastText() { Text = "Settings have roamed to your device" },
         },
     };
     var toast = new ToastNotification(content.GetXml());
     var notifier = ToastNotificationManager.CreateToastNotifier();
     notifier.Show(toast);
 }
 private void Current_DataChanged(ApplicationData sender, object args)
 {
 }
Пример #40
0
 void DataChangeHandler(ApplicationData appData, object o)
 {
 }
 partial void InitializePartial(ApplicationData owner)
 {
     Values = new SharedPreferencesPropertySet();
 }
Пример #42
0
 private static void Current_DataChanged(ApplicationData sender, object args)
 {
     if(OnDataChanged != null)
     {
         // TODO: This callback should be passed some context.. otherwise the user will have no idea
         // on what changed and what to do.
         OnDataChanged();
     }
 }
Пример #43
0
        private void Current_DataChanged(ApplicationData sender, object args)
        {
            Object value = roamingSettings.Values["SeekValue"];

        }
Пример #44
0
 void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
 {
     DoRefresh();
 }
 public ApplicationDataEvents(ApplicationData This)
 {
     this.This = This;
 }
Пример #46
0
 partial void InitializePartial(ApplicationData owner);
Пример #47
0
 static ApplicationData()
 {
     _instance = new ApplicationData();
     _instance.Initialize();
 }