當前位置: 首頁>>代碼示例>>C#>>正文


C# Storage.ApplicationDataContainer類代碼示例

本文整理匯總了C#中Windows.Storage.ApplicationDataContainer的典型用法代碼示例。如果您正苦於以下問題:C# ApplicationDataContainer類的具體用法?C# ApplicationDataContainer怎麽用?C# ApplicationDataContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ApplicationDataContainer類屬於Windows.Storage命名空間,在下文中一共展示了ApplicationDataContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateNewAppSetting

 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);
 }
開發者ID:HimanshPal,項目名稱:Clearing-Windows-AppData,代碼行數:7,代碼來源:MainPage.xaml.cs

示例2: Run

        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(); //所有的異步調用完成之後,釋放延期,表示後台任務的完成
        }
開發者ID:cappuccinoqi,項目名稱:Date_Windows,代碼行數:32,代碼來源:LetterBackgroundTask.cs

示例3: Settings

        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();
        }
開發者ID:liliankasem,項目名稱:Jots,代碼行數:26,代碼來源:Settings.xaml.cs

示例4: MainPage

 public MainPage()
 {
     this.InitializeComponent();
     localSettings = ApplicationData.Current.LocalSettings;
     DisplayOutPut();
     this.NavigationCacheMode = NavigationCacheMode.Required;
 }
開發者ID:745322878,項目名稱:Code,代碼行數:7,代碼來源:MainPage.xaml.cs

示例5: MainPage

 // Constructor
 public MainPage()
 {
     InitializeComponent();
     _settings = ApplicationData.Current.LocalSettings.CreateContainer(
         "settings", 
         ApplicationDataCreateDisposition.Always);
 }
開發者ID:jakopo87,項目名稱:4thandmayor-socialextension-app,代碼行數:8,代碼來源:MainPage.xaml.cs

示例6: Init

        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);
        }
開發者ID:cyberh0me,項目名稱:IoT,代碼行數:27,代碼來源:Discovery.cs

示例7: ApplicationDataSettingsService

 public ApplicationDataSettingsService()
 {
     localSettings = ApplicationData.Current.LocalSettings;
     //SummaryDataUrl = localSettings.Values["SummaryDataUrl"].ToString();
     //HistoricalDataUrl = localSettings.Values["HistoricalDataUrl"].ToString();
     LoadSettings();
 }
開發者ID:jhalbrecht,項目名稱:HomeAmation,代碼行數:7,代碼來源:ApplicationDataSettingsService.cs

示例8: LoginPage

 public LoginPage()
 {
     this.InitializeComponent();
     appSetting = ApplicationData.Current.LocalSettings;
     if (appSetting.Values.ContainsKey("stuNum"))
         StuNumTextBox.Text = appSetting.Values["stuNum"].ToString();
 }
開發者ID:RedrockTeam,項目名稱:ZSCY_Windows_V2.0,代碼行數:7,代碼來源:LoginPage.xaml.cs

示例9: App

        /// <summary>
        /// 初始化單一實例應用程序對象。    這是執行的創作代碼的第一行,
        /// 邏輯上等同於 main() 或 WinMain()。
        /// </summary>
        /// 


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

        }
開發者ID:yyx290799684,項目名稱:WJZZ_WP_RT,代碼行數:14,代碼來源:App.xaml.cs

示例10: SettingsManager

        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);
        }
開發者ID:LdwgWffnschmdt,項目名稱:CykeMaps,代碼行數:28,代碼來源:SettingsManager.cs

示例11: ForumSettingsFlyout

 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];
     }
 }
開發者ID:llenroc,項目名稱:AwfulMetro,代碼行數:29,代碼來源:ForumSettingsFlyout.xaml.cs

示例12: SearchFreeTimeResultPage_new

 public SearchFreeTimeResultPage_new()
 {
     appSetting = ApplicationData.Current.LocalSettings; //本地存儲
     this.InitializeComponent();
     week_old = week = int.Parse(appSetting.Values["nowWeek"].ToString());
     HubSectionKBNum.Text = appSetting.Values["nowWeek"].ToString();
 }
開發者ID:RedrockMobile,項目名稱:CyxbsMobile_Win,代碼行數:7,代碼來源:SearchFreeTimeResultPage_new.xaml.cs

示例13: ScorePage

 public ScorePage()
 {
     appSetting = ApplicationData.Current.LocalSettings; //本地存儲
     this.InitializeComponent();
     Debug.WriteLine("init");
     //SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
 }
開發者ID:RedrockMobile,項目名稱:CyxbsMobile_Win,代碼行數:7,代碼來源:ScorePage.xaml.cs

示例14: SettingsViewModel

        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
        }
開發者ID:xepher,項目名稱:uwp-wxbus,代碼行數:33,代碼來源:SettingsViewModel.cs

示例15: Api

        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"
                });
        }
開發者ID:ar4ebald,項目名稱:VK-Miner,代碼行數:25,代碼來源:Api.cs


注:本文中的Windows.Storage.ApplicationDataContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。