Inheritance: IApplicationDataContainer
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            appSetting = ApplicationData.Current.LocalSettings; //本地存储

            string letterstatus = "";
            BackgroundTaskDeferral deferral = taskInstance.GetDeferral();  //获取 BackgroundTaskDeferral 对象,表示后台任务延期

            List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>();
            paramList.Add(new KeyValuePair<string, string>("uid", appSetting.Values["uid"].ToString()));
            paramList.Add(new KeyValuePair<string, string>("token", appSetting.Values["token"].ToString()));
            letterstatus = Utils.ConvertUnicodeStringToChinese(await NetWork.getHttpWebRequest("/letter/letterstatus", paramList));

            Debug.WriteLine("letterstatus" + letterstatus);
            try
            {
                if (letterstatus != "" && letterstatus.IndexOf("成功") != -1)
                {
                    Debug.WriteLine(letterstatus.IndexOf("letter"));
                    Debug.WriteLine(letterstatus.IndexOf("}"));
                    int letterUnRead = Int32.Parse(letterstatus.Substring(letterstatus.IndexOf("letter") + 9, letterstatus.IndexOf("}") - (letterstatus.IndexOf("letter") + 10 )));
                    if (letterUnRead > Int32.Parse(appSetting.Values["LetterUnRead"].ToString())) //仅当接口中数量>应用中保持的私信数量才推送
                    {
                        Utils.Toast("你有" + letterUnRead + "条未读私信");
                    }
                    appSetting.Values["LetterUnRead"] = letterUnRead; //将保存数值提出来,为了防止在其他平台阅读私信后,本应用永远不推送的问题

                }
            }
            catch (Exception) { Debug.WriteLine("后台任务网络异常"); }

            deferral.Complete(); //所有的异步调用完成之后,释放延期,表示后台任务的完成
        }
 public SearchFreeTimeNumPage()
 {
     appSetting = ApplicationData.Current.LocalSettings; //本地存储
     this.InitializeComponent();
     HubSectionKBNum.Text = appSetting.Values["nowWeek"].ToString();
     appSetting.Values["FreeWeek"] = appSetting.Values["nowWeek"];
 }
        async private void buttonHome_Tapped(object sender, TappedRoutedEventArgs e)
        {
            /*      System Uri aiueo =
             *    webView1.Source = (System Uri)"http://yahoo.co.jp/";*/
            /*      System.Uri URI = webView1.Source;
             *    this.Frame.Navigate(typeof(MainHubPage), "test");*/
            //      this.Frame.Navigate(typeof(MainHubPage));

            //      UrlBox.Text = "http://yahoo.co.jp/";

            string URL = "";

            Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
            try
            {
                UrlBox.Text = (string)roamingSettings.Values["exampleSetting"];
            }
            catch (Exception ex)
            {
                UrlBox.Text = "http://yahoo.co.jp/";
            }
            //UrlBox.Text = URL;

            await NavigateAsync();
        }
Example #4
0
        private async void Add_New_Show(object sender, RoutedEventArgs e)
        {
            // Instantiate window

            string newFeedNameVar;

            AddNewShow          newShow      = new AddNewShow();
            ContentDialogResult addNewResult = await newShow.ShowAsync();

            Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
            Debug.WriteLine(roamingSettings.Values["newFeedName"]);
            Debug.WriteLine(roamingSettings.Values["newRSSName"]);

            Podcast createPodcast = new Podcast();

            createPodcast.stationName = roamingSettings.Values["newFeedName"].ToString();
            createPodcast.stationURL  = roamingSettings.Values["newRSSName"].ToString();

            PodList.Items.Add(createPodcast);

            //podcasts.Add(createPodcast);

            await Dump_Out_XML();

            Debug.WriteLine(podcasts.Count());
        }
Example #5
0
        public SettingsViewModel(IAppBootstrapper bootstrapper, IMessageBus messageBus)
            : base(bootstrapper, messageBus)
        {
            base.PathSegment = Constants.PATH_SEGMENT_SETTINGS;

            this.localSettings = ApplicationData.Current.LocalSettings;

            #region Local Storage Configuration

            // IsLocalStorageOn default value
            _isLocalStorageOn = ApplicationDataSettingsHelper.ReadValue<bool>(Constants.SETTINGS_IS_LOCALSTORAGE_ENABLED);

            this.ObservableForProperty(vm => vm.IsLocalStorageOn)
                .Subscribe(x =>
                {
                    ApplicationDataSettingsHelper.SaveOrUpdateValue(Constants.SETTINGS_IS_LOCALSTORAGE_ENABLED, x.Value);
                });

            #endregion Local Storage Configuration

            #region Location Service Configuration

            // IsLocationServiceOn default value
            _isLocationServiceOn = ApplicationDataSettingsHelper.ReadValue<bool>(Constants.SETTINGS_IS_LOCATION_ENABLED);

            this.ObservableForProperty(vm => vm.IsLocationServiceOn)
                .Subscribe(x =>
                {
                    ApplicationDataSettingsHelper.SaveOrUpdateValue(Constants.SETTINGS_IS_LOCATION_ENABLED, x.Value);
                });

            #endregion Location Service Configuration
        }
Example #6
0
        public MainPage()
        {
            //defaults
            tipRates = new double[] { 0.15, 0.18, 0.20 };
            taxTable = new Dictionary <string, double>();
            this.InitializeComponent();
            TipRate1.Content   = tipRates[0].ToString("P");
            TipRate2.Content   = tipRates[1].ToString("P");
            TipRate2.IsChecked = true;
            TipRate3.Content   = tipRates[2].ToString("P");
            tipRate            = tipRates[1];

            localSettings = ApplicationData.Current.LocalSettings;
            object zipObj = localSettings.Values["zipcode"];

            if (zipObj == null)
            {
                zipCode = "10001";
                taxRate = 0.08875;//New York
            }
            else
            {
                zipCode = zipObj.ToString();
                System.Diagnostics.Debug.WriteLine("Zipcode loaded: " + zipCode);
            }
            uiZipcode.Text = zipCode;

            //load tax rates
            loadTaxRateTable();
            this.NavigationCacheMode = NavigationCacheMode.Required;
        }
Example #7
0
        public Settings()
        {
            this.InitializeComponent();

            roamingSettings = ApplicationData.Current.RoamingSettings;
            localSettings = ApplicationData.Current.LocalSettings;

            inkRecognizerContainer = new InkRecognizerContainer();
            recognizerView = inkRecognizerContainer.GetRecognizers();

            if (recognizerView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recognizerView)
                {
                    RecogizerName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecogizerName.IsEnabled = false;
                RecogizerName.Items.Add("No Recognizer Available");
            }
            

            GetSettings();
        }
Example #8
0
        private void fnRetrieveStyling(Windows.Storage.ApplicationDataContainer localSettings)
        {
            if (localSettings.Values["loginStrfunctionURL"].ToString() != null)
            {
                Login.Instance.propStrFunctionURL = localSettings.Values["LoginStrFunctionURL"].ToString();
                Login.Instance.propStrSystemUsed  = "client_" + localSettings.Values["LoginStrSystem"].ToString().ToLower();
                viewSetting.propStrUsername       = localSettings.Values["SettingsUsername"].ToString();
                viewSetting.propStrSystem         = Login.Instance.propStrSystemUsed;
                viewSetting.propStrUsername       = localSettings.Values["SettingsUsername"].ToString();

                viewSetting.propObSetting.intSystemId                = Int32.Parse(localSettings.Values["SettingsSystemId"].ToString());
                viewSetting.propObSetting.intInterfaceColumns        = Int32.Parse(localSettings.Values["Settingcolumns"].ToString());
                viewSetting.propObSetting.RSSTitle                   = localSettings.Values["SettingsRSSTitle"].ToString();
                viewSetting.propObSetting.RSSFeed                    = localSettings.Values["SettingsRSSFeed"].ToString();
                viewSetting.propObSetting.boolInterfaceStoreUsername = Boolean.Parse(localSettings.Values["SettingsStoreUserName"].ToString());

                viewSetting.propObSetting.strImageLogoUrl    = localSettings.Values["SettingsStoreLogoURL"].ToString();
                viewSetting.propObSetting.strImageBackground = localSettings.Values["SettingsImageBackgroundStr"].ToString();
                viewSetting.propObSetting.strFontColors      = localSettings.Values["SettingsStoreFontColors"].ToString();
                viewSetting.propObSetting.strFontFaces       = localSettings.Values["SettingsStoreFontFaces"].ToString();
                viewSetting.propObSetting.strFontSizes       = localSettings.Values["SettingsStoreFontSizes"].ToString();
                viewSetting.propObSetting.keywords           = localSettings.Values["SettingsStoreKeywords"].ToString();
                myStyle.assignToStyling(viewSetting.propObSetting);
            }
        }
 public ForumSettingsFlyout()
 {
     InitializeComponent();
     _localSettings = ApplicationData.Current.LocalSettings;
     if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_BACKGROUND))
     {
         BookmarkLiveTiles.IsOn = (bool) _localSettings.Values[Constants.BOOKMARK_BACKGROUND];
     }
     if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_STARTUP))
     {
         LoadBookmarksOnLoadSwitch.IsOn = (bool)_localSettings.Values[Constants.BOOKMARK_STARTUP];
     }
     if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_DEFAULT))
     {
         FilterComboBox.SelectedIndex = (int) _localSettings.Values[Constants.BOOKMARK_DEFAULT];
     }
     else
     {
         FilterComboBox.SelectedIndex = 0;
     }
     if (_localSettings.Values.ContainsKey(Constants.DARK_MODE))
     {
         DarkLightThemeSwitch.IsOn = (bool)_localSettings.Values[Constants.DARK_MODE];
     }
     if (_localSettings.Values.ContainsKey(Constants.AUTO_REFRESH))
     {
         AutoReloadSwitch.IsOn = (bool)_localSettings.Values[Constants.AUTO_REFRESH];
     }
 }
Example #10
0
        protected void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            // Reference to Local Application Settings.
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            localSettings.Values["lastViewedTimeStamp"] = DateTime.Now.ToString();
        }
Example #11
0
        public SettingsPage()
        {
            this.InitializeComponent();
            _localSettings = ApplicationData.Current.LocalSettings;
            if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_BACKGROUND))
            {
                BookmarkLiveTiles.IsOn = (bool)_localSettings.Values[Constants.BOOKMARK_BACKGROUND];
            }
            if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_STARTUP))
            {
                LoadBookmarksOnLoadSwitch.IsOn = (bool)_localSettings.Values[Constants.BOOKMARK_STARTUP];
            }

            if (_localSettings.Values.ContainsKey(Constants.AUTO_REFRESH))
            {
                AutoReloadSwitch.IsOn = (bool)_localSettings.Values[Constants.AUTO_REFRESH];
            }

            if (_localSettings.Values.ContainsKey(Constants.DARK_MODE))
            {
                DarkLightThemeSwitch.IsOn = (bool) _localSettings.Values[Constants.DARK_MODE];
            }
            else
            {
                // If the mode was never set, it's automatically true unless the user actually sets it to false.
                DarkLightThemeSwitch.IsOn = true;
            }
            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
        }
Example #12
0
        public static void WriteCoverEventsCollectionData()
        {
            string dataString = ObjectSerializer.CoverEventsToXml(CoverEventsCollection);

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localSettings.Values["coverEventsCollection"] = dataString;
        }
Example #13
0
        private async void Init()
        {
            _Listener = new DatagramSocket();
            _Listener.MessageReceived += Listener_MessageReceived;

            while (true)
            {
                try
                {
                    await _Listener.BindServiceNameAsync("6");
                    break;
                }
                catch (COMException)
                {
                    var messageDialog = new MessageDialog("Only one usage of each port is normally permitted.\r\n\r\nIs 'Windows IoT Core Watcher' open?", "Port in use");
                    messageDialog.Commands.Add(new UICommand("Try again", (command) => { }));
                    await messageDialog.ShowAsync();
                }
            }

            HostName hostname = new HostName("239.0.0.222");
            _Listener.JoinMulticastGroup(hostname);

            _Settings = ApplicationData.Current.LocalSettings;

            _Timer = new Timer(Timer_Callback, null, 1000, 1000);
        }
Example #14
0
        /// <summary>
        /// 初始化单一实例应用程序对象。    这是执行的创作代码的第一行,
        /// 逻辑上等同于 main() 或 WinMain()。
        /// </summary>
        /// 


        public App()
        {
            this.InitializeComponent();
            this.Suspending += this.OnSuspending;
            appSetting = ApplicationData.Current.LocalSettings; //本地存储

        }
 public LoginPage()
 {
     this.InitializeComponent();
     appSetting = ApplicationData.Current.LocalSettings;
     if (appSetting.Values.ContainsKey("stuNum"))
         StuNumTextBox.Text = appSetting.Values["stuNum"].ToString();
 }
Example #16
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            int ss = Convert.ToInt32(localSettings.Values["KeepScreenOn"]);

            if (ss != 0 || ss != 1)
            {
                localSettings.Values["KeepScreenOn"] = "1";
            }
            int mm = Convert.ToInt32(localSettings.Values["MapMode"]);

            if (ss != 0 || ss != 1)
            {
                localSettings.Values["MapMode"] = "0";
            }
            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            UpdateData();
            int mapmode = Convert.ToInt32(localSettings.Values["MapMode"]);

            if (mapmode == 0)
            {
                MapCtrl.Style = MapStyle.Terrain;
            }
            if (mapmode == 1)
            {
                MapCtrl.Style = MapStyle.Aerial;
            }
            else
            {
                MapCtrl.Style = MapStyle.Terrain;
            }
        }
Example #17
0
        private async void displaySolution()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var username = localSettings.Containers["userInfo"].Values["userName"].ToString();
            var client   = new HttpClient();
            var response = await client.GetAsync(new Uri("http://codeinn-acecoders.rhcloud.com:8000/query/solution?username="******"&Id=" + navParam.displayedObject.Id));

            var result = await response.Content.ReadAsStringAsync();

            Debug.WriteLine(result);

            try
            {
                List <SolutionClass> udata = JsonConvert.DeserializeObject <List <SolutionClass> >(result);
            }
            catch
            {
                Debug.WriteLine("error");
            }

            List <string> lis = new List <string>();

            lis.Add(navParam.displayedObject.Content);
            var returnstatus = await webView4.InvokeScriptAsync("setText", lis);

            Debug.WriteLine(returnstatus);
        }
        public SettingsManager(ref MapControl MapMain)
        {
            // Check is the instance doesnt already exist.
            if (Current != null)
            {
                //if there is an instance in the app already present then simply throw an error.
                throw new Exception("Only one settings manager can exist in a App.");
            }

            // Setting the instance to the static instance field.
            Current = this;

            this.MapMain = MapMain;

            ApplicationData.Current.DataChanged += new TypedEventHandler<ApplicationData, object>(DataChangeHandler);

            // Roaming Settings
            RoamingSettings = ApplicationData.Current.RoamingSettings;

            RoamingSettings.CreateContainer("Map", ApplicationDataCreateDisposition.Always);
            RoamingSettings.CreateContainer("Appearance", ApplicationDataCreateDisposition.Always);
            

            // Local Settings
            LocalSettings = ApplicationData.Current.LocalSettings;

            LocalSettings.CreateContainer("Location", ApplicationDataCreateDisposition.Always);
        }
Example #19
0
 // Load the ComDetails object from the application's local settings as an ApplicationDataCompositeValue instance.
 // Iterate through the properties in the static class of current app settings, that are in a static class.
 // If a property is in the ComDetails keys, assign the value for that key as in ComDetail, to the static class property.
 public static void LoadConSettings()
 {
     Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     if (localSettings.Values.Keys.Contains("ConDetail"))
     {
         Windows.Storage.ApplicationDataCompositeValue composite =
             (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["ConDetail"];
         if (composite != null)
         {
             //Ref: https://stackoverflow.com/questions/9404523/set-property-value-using-property-name
             Type type = typeof(Pages.IoTHubConnectionDetails);                                                                          // IoTHubConnectionDetails is static class with public static properties
             foreach (var property in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) //(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic))
             {
                 string propertyName = property.Name;
                 if (composite.Keys.Contains(propertyName))
                 {
                     //Want to implement Cons.propertyName = composite[propertyName];
                     var propertyInfo = type.GetProperty(propertyName); //, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                     propertyInfo.SetValue(type, composite[propertyName], null);
                 }
             }
         }
     }
     else
     {
         //Pages.IoTHubConnectionDetails.
     }
 }
 public ApplicationDataSettingsService()
 {
     localSettings = ApplicationData.Current.LocalSettings;
     //SummaryDataUrl = localSettings.Values["SummaryDataUrl"].ToString();
     //HistoricalDataUrl = localSettings.Values["HistoricalDataUrl"].ToString();
     LoadSettings();
 }
Example #21
0
        private async void Flyout_Closed(object sender, object e)
        {
            List <ChooseFeedItem> CurrentItem = new List <ChooseFeedItem>();

            CurrentItem.Clear();
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            for (int i = 0; i < ViewModel.Item.Count; i++)
            {
                ChooseFeedItem item = ViewModel.Item[i];
                if (Choose_GridView.SelectedItems.Contains(item))
                {
                    localSettings.Values[item.Title] = true;
                    CurrentItem.Add(item);
                }
                else
                {
                    localSettings.Values[item.Title] = false;
                }
            }
            if (ViewModel.ChooseSelectedItem.Count != CurrentItem.Count)
            {
                ViewModel.RefreshCommand.Execute();
            }

            ViewModel.ChooseSelectedItem = CurrentItem;
        }
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     _settings = ApplicationData.Current.LocalSettings.CreateContainer(
         "settings", 
         ApplicationDataCreateDisposition.Always);
 }
Example #23
0
        // Create a new instance of ApplicationDataCompositeValue object as ComDetail
        // Iterate through the properties of a static class and store each name value pair in a ComDetail
        // Save that to the application's local settings, replacing the existing object if it exists.
        public static void SaveSettingsToAppData()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (localSettings.Values.Keys.Contains("ConDetail"))
            {
                localSettings.Values.Remove("ConDetail");
            }
            Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();

            //Ref: https://stackoverflow.com/questions/12480279/iterate-through-properties-of-static-class-to-populate-list
            Type type = typeof(Pages.IoTHubConnectionDetails); // IoTHubConnectionDetails is static class with public static properties

            foreach (var property in type.GetProperties())     //(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic))
            {
                string propertyName = property.Name;
                var    val          = property.GetValue(null); // static classes cannot be instanced, so use null...

                System.Diagnostics.Debug.WriteLine(string.Format("{0} {1}", propertyName, val));
                composite[propertyName] = val;
            }
            localSettings.Values.Add("ConDetail", composite);

            if (localSettings.Values.Keys.Contains("AppSettingsValues"))
            {
                localSettings.Values.Remove("AppSettingsValues");
            }
        }
Example #24
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);
            }
        }
        /// <summary>
        /// 检测user合法性
        /// </summary>
        /// <returns></returns>
        private async Task <bool> CheckUserExist( )
        {
            bool exists = false;

            try
            {
                Windows.Storage.ApplicationDataContainer localSettings =
                    Windows.Storage.ApplicationData.Current.LocalSettings;
                Object existuser = localSettings.Values["currentUser"];

                if (existuser != null && existuser.ToString() != "")
                {
                    var users = await User.FindAllAsync();

                    var currentDomainUser = await users.FirstOrDefault().GetPropertyAsync(KnownUserProperties.DomainName);

                    var currentUser = await users.FirstOrDefault().GetPropertyAsync(KnownUserProperties.DisplayName);

                    if (existuser.ToString() == currentUser.ToString())
                    {
                        exists = true;
                    }
                }
            }
            catch
            {
                exists = false;
            }
            return(await Task.FromResult(exists));;
        }
Example #26
0
        protected void App_Resuming(Object sender, Object e)
        {
            // Reference to Local Application Settings.
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            string lastViewedTimeStamp = (string)localSettings.Values["lastViewedTimeStamp"];
        }
        public SettingPage()
        {
            this.InitializeComponent();
            playEnablerGUIDList = new Dictionary <string, string>();
            explicitGuidList    = new Dictionary <string, string>();

            playEnablerGUIDList.Add("None", "None");
            playEnablerGUIDList.Add("Unknown Output", "{786627d8-c2a6-44be-8f88-08ae255b01a7}");
            playEnablerGUIDList.Add("Unknown Output Constrained", "{b621d91f-edcc-4035-8d4b-dc71760d43e9}");

            explicitGuidList.Add("cbBestEffortCGMS_A", "{225CD36F-F132-49EF-BA8C-C91EA28E4369}");
            explicitGuidList.Add("cbCGMS_A", "{2098DE8D-7DDD-4BAB-96C6-32EBB6FABEA3}");
            explicitGuidList.Add("cbDigitalOnlyToken", "{760AE755-682A-41E0-B1B3-DCDF836A7306}");
            explicitGuidList.Add("cbAGCColorStrip", "{C3FD11C6-F8B7-4D20-B008-1DB17D61F2DA}");
            explicitGuidList.Add("cbMaxVGARes", "{D783A191-E083-4BAF-B2DA-E69F910B3772}");
            explicitGuidList.Add("cbMaxComonentRes", "{811C5110-46C8-4C6E-8163-C0482A15D47E}");
            explicitGuidList.Add("cbHCMSorHDCP", "{6D5CFA59-C250-4426-930E-FAC72C8FCFA6}");
            explicitGuidList.Add("cbHDCPType1", "{ABB2C6F1-E663-4625-A945-972D17B231E7}");
            explicitGuidList.Add("tbMaxResDecoderWidth", "{9645E831-E01D-4FFF-8342-0A720E3E028F}");

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            composite     = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["CustomRightsSettings"];

            if (composite == null)
            {
                composite = new Windows.Storage.ApplicationDataCompositeValue();
            }

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
            this.navigationHelper.SaveState += navigationHelper_SaveState;

            // Disable the cbOptoutHWDRM if the itemPage has launched before
            cbOptoutHWDRM.IsEnabled = !SettingPage.DiableOptOutHWDRM;
        }
Example #28
0
        /// このセクションに示したメソッドは、NavigationHelper がページの
        /// ナビゲーション メソッドに応答できるようにするためにのみ使用します。
        ///
        /// ページ固有のロジックは、
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// および <see cref="GridCS.Common.NavigationHelper.SaveState"/> のイベント ハンドラーに配置する必要があります。
        /// LoadState メソッドでは、前のセッションで保存されたページの状態に加え、
        /// ナビゲーション パラメーターを使用できます。

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            //     SettingsPane.GetForCurrentView().CommandsRequested += MainGroupPage_CommandsRequested;
            try
            {
                Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
                string URL = (string)roamingSettings.Values["exampleSetting"];

                Uri newUri;
                Uri.TryCreate(URL, UriKind.Absolute, out newUri);

                if (this.UrlBox.Text == "")
                {
                    //  this.webView1.Navigate(newUri);
                    //webView1.Source = URL;
                }
                else
                {
                    //  Uri.TryCreate(this.UrlBox.Text, UriKind.Absolute, out newUri);
                    // this.webView1.Navigate(newUri);
                }
            }
            catch (Exception ex)
            { }

            navigationHelper.OnNavigatedTo(e);
        }
Example #29
0
        static Api()
        {
            CredentialContainer = ApplicationData.Current.LocalSettings.CreateContainer(
                "[VK Miner] Entry data",
                ApplicationDataCreateDisposition.Always);

            const string scope = "friends,photos,audio,video,status,wall,groups,offline";
            const string blank = "https://oauth.vk.com/blank.html";
            const string url = "https://oauth.vk.com/authorize"
                               + "?client_id=4989758"
                               + "&scope=" + scope
                               + "&redirect_uri=" + blank
                               + "&display=popup"
                               + "&response_type=token";
            AuthStartUri = new Uri(url);
            AuthEndUri = new Uri(blank);

            RequestStopwatch = Stopwatch.StartNew();

            CheckTokenRequestCreator = RequestData.Creator<Func<RequestData>>("users.get",
                new RequestArgs()
                {
                    ["fields"] = "photo_50"
                });
        }
Example #30
0
        BackgroundTaskDeferral _deferral; // Note: defined at class scope so we can mark it complete inside the OnCancel() callback if we choose to support cancellation
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            _deferral = taskInstance.GetDeferral();
            //
            // TODO: Insert code to start one or more asynchronous methods using the
            //       await keyword, for example:
            //
            // await ExampleMethodAsync();
            //
            Debug.WriteLine("Back");
            //var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/test.txt", UriKind. Absolute));
            var         localFolder = ApplicationData.Current.LocalFolder;
            StorageFile file        = await localFolder.CreateFileAsync("test.text", CreationCollisionOption.OpenIfExists);

            await Windows.Storage.FileIO.WriteTextAsync(file, "Swift as a shadow");

            // Composite setting
            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;
            Windows.Storage.ApplicationDataCompositeValue composite =
                (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["exampleCompositeSetting"];

            if (composite == null)
            {
                // No data
            }
            else
            {
                // Access data in composite["intVal"] and composite["strVal"]
                Debug.WriteLine(composite["intVal"]);
            }

            _deferral.Complete();
        }
        public LoginPage()
        {
            this.InitializeComponent();
            this.Loaded += LoginPage_Loaded;

            localData = ApplicationData.Current.LocalSettings;
        }
Example #32
0
        public static string GetFriendlyDate(DateTimeOffset d)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var elapsed = DateTimeOffset.Now - d;

            string returnformat = Enum.Parse <TimeStyle>(localSettings.Values[LocalSettings.DateTimeFormat].ToString()) == TimeStyle.Application ? "D" : "g";

            if (elapsed.TotalDays > 7)
            {
                return(d.ToString(returnformat));
            }
            else if (elapsed.TotalDays > 1)
            {
                return($"{elapsed.Days} days ago");
            }
            else if (elapsed.TotalHours > 1)
            {
                return($"{elapsed.Hours} hours ago");
            }
            else if (elapsed.TotalMinutes > 1)
            {
                return($"{elapsed.Minutes} minutes ago");
            }
            else
            {
                return($"{elapsed.Seconds} seconds ago");
            }
        }
 private void CreateNewAppSetting(ApplicationDataContainer settingContainer)
 {
     var settingKey = Guid.NewGuid().ToString();
     var settingValue = DateTime.Now.ToString();
     settingContainer.Values[settingKey] = settingValue;
     LastStatus.Text = String.Format("Created new {0} setting Key: {1} Value: {2}", settingContainer.Locality.ToString(), settingKey, settingValue);
 }
Example #34
0
 public MainPage()
 {
     this.InitializeComponent();
     localSettings = ApplicationData.Current.LocalSettings;
     DisplayOutPut();
     this.NavigationCacheMode = NavigationCacheMode.Required;
 }
Example #35
0
        public void RemoveSite(string key)
        {
            Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
            Windows.Storage.ApplicationDataContainer container       = roamingSettings.CreateContainer("hapSites", Windows.Storage.ApplicationDataCreateDisposition.Always);

            if (key != "site0")
            {
                PasswordVault vault = new PasswordVault();
                if (vault.FindAllByResource("HAP+ Credentials").Count(c => c.UserName.EndsWith(Settings[key].Address.DnsSafeHost)) == 1)
                {
                    vault.Remove(vault.FindAllByResource("HAP+ Credentials").Single(c => c.UserName.EndsWith(Settings[key].Address.DnsSafeHost)));
                }
            }

            roamingSettings.Containers["hapSites"].Values.Remove(key);
            List <string> s = new List <string>();

            s.AddRange((string[])roamingSettings.Values["sites"]);
            s.Remove(key);
            if (s.Count == 0)
            {
                roamingSettings.Containers["hapSites"].Values["site0"] = new string[] { "site0", "" };
                roamingSettings.Values["sites"] = new string[] { "site0" };
            }
            else
            {
                roamingSettings.Values["sites"] = s.ToArray();
            }
        }
 public SearchFreeTimeResultPage_new()
 {
     appSetting = ApplicationData.Current.LocalSettings; //本地存储
     this.InitializeComponent();
     week_old = week = int.Parse(appSetting.Values["nowWeek"].ToString());
     HubSectionKBNum.Text = appSetting.Values["nowWeek"].ToString();
 }
Example #37
0
        public MainPage()
        {
            this.InitializeComponent();
            Helpers.Payload payload = new Helpers.Payload();
            ViewModel = new MainPageViewModel();
            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;

            Object value = localSettings.Values["DefaultPage"]; // Получить настройки стартовой страницы и навигировать

            try
            {
                int n;
                int.TryParse(localSettings.Values["NumberOfOnetimeLoadedItems"].ToString(), out n);
            } catch (Exception)
            {
                localSettings.Values["NumberOfOnetimeLoadedItems"] = 30; // Установить количество записей по-умолчанию, если неопределено
            }

            if (value != null)
            {
                payload.parameter = value.ToString();
                GeneralFrame.Navigate(typeof(News), payload);
            }
            else
            {
                payload.parameter = "News";
                GeneralFrame.Navigate(typeof(News), payload);
            }
        }
 public ScorePage()
 {
     appSetting = ApplicationData.Current.LocalSettings; //本地存储
     this.InitializeComponent();
     Debug.WriteLine("init");
     //SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
 }
Example #39
0
        void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
        {
            // TODO: This is the time to save app data in case the process is terminated

            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;
            Windows.Storage.ApplicationDataCompositeValue TypeSUP =
                new Windows.Storage.ApplicationDataCompositeValue();
            TypeSUP.Clear();
            TypeSUP["nb"] = SUPCategory.Count;
            for (int i = 0; i < SUPCategory.Count; i++)
            {
                string I    = i.ToString();
                string name = I + "NAME";
                string id   = I + "ID";
                string demi = I + "DEMI";
                string hour = I + "HOUR";
                string supp = I + "SUPP";

                TypeSUP[name] = SUPCategory[i].Name.ToString();
                TypeSUP[id]   = SUPCategory[i].ID.ToString();
                TypeSUP[demi] = SUPCategory[i].Demi.ToString();
                TypeSUP[hour] = SUPCategory[i].Hour.ToString();
                TypeSUP[supp] = SUPCategory[i].Supp.ToString();
            }
            localSettings.Values["TypeOfSUP"] = TypeSUP;

            Windows.Storage.ApplicationDataCompositeValue SUPStock =
                new Windows.Storage.ApplicationDataCompositeValue();
            SUPStock.Clear();
            SUPStock["nb"] = StockSUP.Count;
            for (int i = 0; i < StockSUP.Count; i++)
            {
                string I    = i.ToString();
                string type = I + "TYPE";
                string id   = I + "ID";

                SUPStock[id]   = StockSUP[i].getID();
                SUPStock[type] = StockSUP[i].strType;
            }
            localSettings.Values["StockSUP"] = SUPStock;

            Windows.Storage.ApplicationDataCompositeValue SUPAway =
                new Windows.Storage.ApplicationDataCompositeValue();
            SUPAway.Clear();
            SUPAway["nb"] = AwaySUP.Count;
            for (int i = 0; i < AwaySUP.Count; i++)
            {
                string I    = i.ToString();
                string type = I + "TYPE";
                string id   = I + "ID";
                string time = I + "TIME";

                SUPAway[id]   = AwaySUP[i].getID();
                SUPAway[type] = AwaySUP[i].strType;
                SUPAway[time] = AwaySUP[i].getDeparture();
            }
            localSettings.Values["AwaySUP"] = SUPAway;
        }
Example #40
0
        private async void Init()
        {
            PushNotificationChannel channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

            channel.PushNotificationReceived += OnPushNotification;

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            string Notification = (string)localSettings.Values["NotificationHub"];
            string Connection   = (string)localSettings.Values["ConnectionString"];
            string Tag          = (string)localSettings.Values["Tag"];

            try
            {
                NotificationHub hub = new NotificationHub(Notification, Connection);

                //userTag[0] = tag;
                if (!String.IsNullOrWhiteSpace(Tag))
                {
                    string[] userTag = Tag.Split(";".ToCharArray());
                    var      result  = await hub.RegisterNativeAsync(channel.Uri, userTag); //

                    // Displays the registration ID so you know it was successful
                    if (result.RegistrationId != null)
                    {
                    }
                    else
                    {
                        var dialog = new MessageDialog("Registration failed. Please check the configuration");
                        await dialog.ShowAsync();
                    }
                }
                else
                {
                    Registration result = await hub.RegisterNativeAsync(channel.Uri, null); //

                    // Displays the registration ID so you know it was successful
                    if (result.RegistrationId != null)
                    {
                        //// txtResult.Text = ;
                        //var dialog = new MessageDialog("Registration successful: " + result.RegistrationId);
                        //await dialog.ShowAsync();
                    }
                    else
                    {
                        var dialog = new MessageDialog("Registration failed. Please check the configuration");
                        await dialog.ShowAsync();
                    }
                }
            }
            catch (Exception Ex)
            {
                ContentDialog1 dialog = new ContentDialog1()
                {
                    Title = "Configure connection",
                };

                await dialog.ShowAsync();
            }
        }
            public static void createFavorites()
            {
                Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
                roamingFolder = Windows.Storage.ApplicationData.Current.RoamingFolder;
                SampleDataGroup Comics = new SampleDataGroup("Favorites", "Favorites", "Favorites", "", "");

                SampleDataSource._sampleDataSource._allGroups.Add(Comics);
            }
Example #42
0
        void InitHandlers()
        {
            Windows.Storage.ApplicationData.Current.DataChanged +=
                new TypedEventHandler <ApplicationData, object>(DataChangeHandler);

            Windows.Storage.ApplicationDataContainer roamingSettings =
                Windows.Storage.ApplicationData.Current.RoamingSettings;
        }
        /// <summary>
        /// Initializes a new <see cref="ApplicationDataStore"/> instance.
        /// </summary>
        /// <param name="applicationDataContainer">The application data container in which the configuration is to be stored.</param>
        public ApplicationDataStore(ApplicationDataContainer applicationDataContainer)
        {
            // Stores the application data container and name of the container in which the coinfiguration is to be stored
            this.ApplicationDataContainer = applicationDataContainer;

            // Subscribes to the data changed event of the application data, when the application data changes, then the configuration changed event is raised
            ApplicationData.Current.DataChanged += (sender, e) => this.ConfigurationChanged?.Invoke(this, new EventArgs());
        }
        public DetailDatePage()
        {
            appSetting = ApplicationData.Current.LocalSettings; //本地存储
            this.InitializeComponent();
            getGradeInfor();
            DateDetailScrollViewer.Height = Utils.getPhoneHeight() - 60 - 85;

        }
Example #45
0
 private void saveConfigButton_Click(object sender, RoutedEventArgs e)
 {
     Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     SetConfig_Bool(localSettings, "EnableWings", enableWingsCheckbox.IsChecked.GetValueOrDefault());
     SetConfig_Bool(localSettings, "EnableHead", enableHeadCheckbox.IsChecked.GetValueOrDefault());
     SetConfig_Bool(localSettings, "EnableLeftEye", enableLeftEyeCheckbox.IsChecked.GetValueOrDefault());
     SetConfig_Bool(localSettings, "EnableRightEye", enableRightEyeCheckbox.IsChecked.GetValueOrDefault());
 }
Example #46
0
        public static void SetCoverSource(string coverStr)
        {
            string path = "Assets/CoverBG/" + coverStr + ".jpg";

            Source.CoverSource = path;
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localSettings.Values["coverSource"] = path;
        }
 /// <summary>
 /// Handler for suspending the app; saves state to the cloud
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void App_Suspending(Object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
     roamingSettings.Values["access_token"]  = current_state.access_token;
     roamingSettings.Values["refresh_token"] = current_state.refresh_token;
     roamingSettings.Values["expire_time"]   = current_state.expire_time.ToString();
     roamingSettings.Values["logged_in"]     = current_state.logged_in;
 }
Example #48
0
 //-------------------------------------------------------------------------------------
 // Class constructor
 /// <summary>
 /// Class constructor. Scope is internal so external code cannot create instances.
 /// </summary>
 static SettingsManager()
 {
     #if !WINDOWS_PHONE
     // Initialise the _settings object
     _settings = ApplicationData.Current.LocalSettings;
     _settings.CreateContainer("main", ApplicationDataCreateDisposition.Always);
     #endif
 }
        public SettingsViewModel()
        {
            localSettings = ApplicationData.Current.LocalSettings;

            var config = ResourceLoader.GetForViewIndependentUse("Configuration");
            client_id = config.GetString("client_id"); 
            client_secret = config.GetString("client_secret");
        }
Example #50
0
 public BridgeConnector(string ip = "localhost", int port = 80)
 {
     Ip = ip;
     Port = port;            
     _settings = ApplicationData.Current.RoamingSettings;
     ApplicationData.Current.DataChanged += Current_DataChanged;
     GetUsername();
 }
 public CameraSettingsDialog()
 {
     localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
     this.InitializeComponent();
     InitializeCameraAsync();
     DataContext = this;
 }
 public DataViewModel()
 {
     myInstance    = this;
     localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     localFolder   = Windows.Storage.ApplicationData.Current.LocalFolder;
     composite     = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["DataStoreViewModel"];
     LoadLocalSettings();
 }
        public CompositeSettings()
        {
            this.InitializeComponent();

            roamingSettings = ApplicationData.Current.RoamingSettings;

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

            localSettings = ApplicationData.Current.LocalSettings;

            DisplayOutput();
        }
 public SetHeadPage()
 {
     this.InitializeComponent();
     headScrollViewer.Width = Utils.getPhoneWidth();
     headScrollViewer.Height = Utils.getPhoneWidth();
     appSetting = ApplicationData.Current.LocalSettings; //本地存储
     statusBar.HideAsync();
 }
Example #56
0
        public RoamingSettings()
        {
            this._roamingSettings = ApplicationData.Current.RoamingSettings;
            this._roamingFolder = ApplicationData.Current.RoamingFolder;

            ApplicationData.Current.DataChanged +=
                new TypedEventHandler<ApplicationData, object>(DataChangeHandler);
        }
        public HighPriority()
        {
            this.InitializeComponent();

            applicationData = ApplicationData.Current;
            roamingSettings = applicationData.RoamingSettings;
            
            DisplayOutput(false);
        }
Example #58
0
 public static void NewConSettings()
 {
     Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     if (localSettings.Values.Keys.Contains("ConDetail"))
     {
         localSettings.Values.Remove("ConDetail");
         LoadConSettings();
     }
 }
 public BookmarkSettingsFlyout()
 {
     InitializeComponent();
     _localSettings = ApplicationData.Current.LocalSettings;
     if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_BACKGROUND))
     {
         BookmarkLiveTiles.IsOn = (bool) _localSettings.Values[Constants.BOOKMARK_BACKGROUND];
     }
 }
Example #60
0
 /// <summary>
 /// Inicjuje pojedynczy obiekt aplikacji. Jest to pierwszy wiersz napisanego kodu
 /// wykonywanego i jest logicznym odpowiednikiem metod main() lub WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     this.ViewModel   = new DataViewModel();
     localSettings    = Windows.Storage.ApplicationData.Current.LocalSettings;
     localFolder      = Windows.Storage.ApplicationData.Current.LocalFolder;
     composite        = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["DataStoreViewModel"];
 }