- Application_Places_System
- Re: Application_Places_System
- Re: Application_Places_System
- Re: Application_Places_System
- Re: Application_Places_System
- Application Класс
- Определение
- Примеры
- Комментарии
- Конструкторы
- Свойства
- Методы
- События
- Явные реализации интерфейса
- Применяется к
- Потокобезопасность
- Store and retrieve settings and other app data
- Types of app data
- Settings
- Files
- Storing app data in the app data stores
- Local app data
- Retrieve the local app data store
- Create and retrieve a simple local setting
- Create and retrieve a local composite value
- Create and read a local file
- Roaming data
- Roaming data do’s and don’ts
- Roaming pre-requisites
- Conflict resolution
- When to write data
- Excessive usage protection
- Versioning
- Testing and tools
- Register to receive notification when roaming data changes
- Create and retrieve roaming settings
- Create and retrieve roaming files
- Temporary app data
- Retrieve the temporary data container
- Create and read temporary files
- Organize app data with containers
Application_Places_System
Решил все таки обновиться с седьмой федоры на восьмую. Под рукой был только Fedora 8 Live Gnome. Установил все-таки этот глюкодром. Они даже Ping умудрились сломать. Как такое может называться релизом?
Сабж в том, что с лайв-двд поставлялся только английский язык. После установки Русский он мне не поставил, но доустановив его из репозиториев я понял, что в принципе на буржуйском Gnome симпотичнее смотриться.
(Application | Places | System) vs (Приложения | Места | Система)
А какой язык-интерфейся в системе у вас?
P.S. Английского почти не знаю.
Re: Application_Places_System
>А какой язык-интерфейся в системе у вас?
У меня интерфейс русский, просто потому что мне так нравится.
Re: Application_Places_System
English. Just because I like it.
Re: Application_Places_System
еще кстати бесит Русский в консоли. Ладно маны, но «command not found» можно и оставить.
Re: Application_Places_System
Русский, бо считаю себя таковым
англоязычный интерфей проблем не вызывает (уровень английского — ниже среднего)
Application Класс
Определение
Инкапсулирует приложение Windows Presentation Foundation. Encapsulates a Windows Presentation Foundation application.
Примеры
В следующем примере показано, как стандартное приложение определяется с использованием только разметки: The following example shows how a standard application is defined using only markup:
В следующем примере показано, как стандартное приложение определяется с использованием только кода. The following example shows how a standard application is defined using only code:
В следующем примере показано определение стандартного приложения с помощью сочетания разметки и кода программной части. The following example shows how a standard application is defined using a combination of markup and code-behind.
Комментарии
Application — Это класс, инкапсулирующий функции WPF, относящиеся к приложению, включая следующие: Application is a class that encapsulates WPF application-specific functionality, including the following:
Параметры командной строки и обработка кода выхода: Application.Startup , Application.Exit , Application.Shutdown . Command-Line Parameter and Exit Code Processing: Application.Startup, Application.Exit, Application.Shutdown.
Application реализует Одноэлементный шаблон для предоставления общего доступа к службам окна, свойства и области ресурсов. Application implements the singleton pattern to provide shared access to its window, property, and resource scope services. Следовательно, для каждого экземпляра можно создать только один экземпляр Application класса AppDomain . Consequently, only one instance of the Application class can be created per AppDomain.
Можно реализовать Application с помощью разметки, разметки и кода программной части или кода. You can implement an Application using markup, markup and code-behind, or code. Если Application реализуется с разметкой (разметка или разметка и код программной части), то файл разметки должен быть настроен как элемент Microsoft Build Engine (MSBuild) ApplicationDefinition . If Application is implemented with markup, whether markup or markup and code-behind, the markup file must be configured as an Microsoft build engine (MSBuild) ApplicationDefinition item.
Для автономного приложения не требуется Application объект; можно реализовать пользовательский static метод точки входа ( Main ), который открывает окно без создания экземпляра Application . A standalone application does not require an Application object; it is possible to implement a custom static entry point method ( Main ) that opens a window without creating an instance of Application. Однако для приложений браузера XAML (XBAP) требуется Application объект. However, XAML browser applications (XBAPs) require an Application object.
Конструкторы
Инициализирует новый экземпляр класса Application. Initializes a new instance of the Application class.
Свойства
Возвращает объект Application для текущего AppDomain. Gets the Application object for the current AppDomain.
Возвращает объект Dispatcher, с которым связан этот объект DispatcherObject. Gets the Dispatcher this DispatcherObject is associated with.
(Унаследовано от DispatcherObject)
Получает или задает главное окно приложения. Gets or sets the main window of the application.
Возвращает коллекцию свойств области приложения. Gets a collection of application-scope properties.
Возвращает или задает объект Assembly , предоставляющий универсальные идентификаторы ресурсов (URI) Pack для ресурсов в приложении WPF. Gets or sets the Assembly that provides the pack uniform resource identifiers (URIs) for resources in a WPF application.
Получает или задает коллекцию ресурсов области приложения, например, стилей и кистей. Gets or sets a collection of application-scope resources, such as styles and brushes.
Получает или задает условие, которое является причиной вызова метода Shutdown(). Gets or sets the condition that causes the Shutdown() method to be called.
Получает или задает пользовательский интерфейс, отображающееся автоматически при запуске приложения. Gets or sets a UI that is automatically shown when an application starts.
Возвращает созданные окна приложения. Gets the instantiated windows in an application.
Методы
Определяет, имеет ли вызывающий поток доступ к этому DispatcherObject. Determines whether the calling thread has access to this DispatcherObject.
(Унаследовано от DispatcherObject)
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
(Унаследовано от Object)
Выполняет поиск ресурса пользовательского интерфейса (например Style Brush , или) с указанным ключом и создает исключение, если запрошенный ресурс не найден (см. раздел ресурсы XAML). Searches for a user interface (UI) resource, such as a Style or Brush, with the specified key, and throws an exception if the requested resource is not found (see XAML Resources).
Возвращает поток ресурса для файла данных содержания, расположенного в указанном Uri (см. Ресурсы, содержимое и файлы данных WPF-приложения). Returns a resource stream for a content data file that is located at the specified Uri (see WPF Application Resource, Content, and Data Files).
Возвращает файл cookie для расположения, указанного Uri. Retrieves a cookie for the location specified by a Uri.
Служит хэш-функцией по умолчанию. Serves as the default hash function.
(Унаследовано от Object)
Возвращает поток ресурса для исходного файла данных ресурса, расположенного в указанном Uri (см. Ресурсы, содержимое и файлы данных WPF-приложения). Returns a resource stream for a site-of-origin data file that is located at the specified Uri (see WPF Application Resource, Content, and Data Files).
Возвращает поток ресурса для файла данных ресурса, расположенного в указанном Uri (см. Ресурсы, содержимое и файлы данных WPF-приложения). Returns a resource stream for a resource data file that is located at the specified Uri (see WPF Application Resource, Content, and Data Files).
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Загружает XAML-файл, расположенный по указанному универсальному идентификатору ресурса (URI), и преобразует его в экземпляр объекта, указанный в корневом элементе файла XAML. Loads a XAML file that is located at the specified uniform resource identifier (URI) and converts it to an instance of the object that is specified by the root element of the XAML file.
Загружает XAML-файл, расположенный по указанному универсальному идентификатору ресурса (URI), и преобразует его в экземпляр объекта, указанный в корневом элементе файла XAML. Loads a XAML file that is located at the specified uniform resource identifier (URI), and converts it to an instance of the object that is specified by the root element of the XAML file.
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Вызывает событие Activated. Raises the Activated event.
Вызывает событие Deactivated. Raises the Deactivated event.
Вызывает событие Exit. Raises the Exit event.
Вызывает событие LoadCompleted. Raises the LoadCompleted event.
Вызывает событие Navigated. Raises the Navigated event.
Вызывает событие Navigating. Raises the Navigating event.
Вызывает событие NavigationFailed. Raises the NavigationFailed event.
Вызывает событие SessionEnding. Raises the SessionEnding event.
Вызывает событие Startup. Raises the Startup event.
Запускает приложение Windows Presentation Foundation. Starts a Windows Presentation Foundation application.
Запускает приложение Windows Presentation Foundation с открытием указанного окна. Starts a Windows Presentation Foundation application and opens the specified window.
Создает файл cookie для расположения, указанного Uri. Creates a cookie for the location specified by a Uri.
Завершить работу приложения. Shuts down an application.
Завершает работу приложения и передает указанный код завершения операционной системой. Shuts down an application that returns the specified exit code to the operating system.
Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.
(Унаследовано от Object)
Осуществляет поиск указанного ресурса. Searches for the specified resource.
Обеспечивает наличие у вызывающего потока доступ к этому DispatcherObject. Enforces that the calling thread has access to this DispatcherObject.
(Унаследовано от DispatcherObject)
События
Происходит, когда приложение становиться активным. Occurs when an application becomes the foreground application.
Происходит, когда приложение перестает быть активным. Occurs when an application stops being the foreground application.
Происходит при генерации приложением исключения, которое не обрабатывается. Occurs when an exception is thrown by an application but not handled.
Происходит непосредственно перед завершением работы приложения и его отменой. Occurs just before an application shuts down and cannot be canceled.
Происходит, когда навигатор в приложении начинает переход к фрагменту содержимого, переход происходит немедленно, если нужный фрагмент находится в текущем содержимом, или после загрузки исходного содержимого XAML, если нужный фрагмент находится в другом содержимом. Occurs when a navigator in the application begins navigation to a content fragment, Navigation occurs immediately if the desired fragment is in the current content, or after the source XAML content has been loaded if the desired fragment is in different content.
Происходит после того, как содержимое, переданное приложению, было загружено, проанализировано и отрисовывается. Occurs when content that was navigated to by a navigator in the application has been loaded, parsed, and has begun rendering.
Происходит, когда содержимое, к которому осуществляется переход, найдено, хотя его загрузка, возможно, еще не завершена. Occurs when the content that is being navigated to by a navigator in the application has been found, although it may not have completed loading.
Происходит при запросе приложением перехода. Occurs when a new navigation is requested by a navigator in the application.
Происходит, когда происходит ошибка при переходе к указанному содержимому. Occurs when an error occurs while a navigator in the application is navigating to the requested content.
Происходит время от времени во время загрузки, управляемой приложением для предоставления информации о статусе загрузки. Occurs periodically during a download that is being managed by a navigator in the application to provide navigation progress information.
Появляется при вызове метода перехода приложения StopLoading , или когда поступил запрос нового перехода во время выполнения текущего. Occurs when the StopLoading method of a navigator in the application is called, or when a new navigation is requested by a navigator while a current navigation is in progress.
Происходит, когда пользователь завершает сеанс Windows, выходя из системы или завершая работу операционной системы. Occurs when the user ends the Windows session by logging off or shutting down the operating system.
Происходит при вызове метода Run() объекта Application. Occurs when the Run() method of the Application object is called.
Явные реализации интерфейса
Запрашивает, доступно ли заданное внешнее свойство в текущей области. Queries for whether a specified ambient property is available in the current scope.
Применяется к
Потокобезопасность
Открытые static ( Shared в Visual Basic) члены этого типа являются потокобезопасными. The public static ( Shared in Visual Basic) members of this type are thread safe. Кроме того, FindResource(Object) методы и TryFindResource(Object) и свойства и Properties Resources являются потокобезопасными. In addition, the FindResource(Object) and TryFindResource(Object) methods and the Properties and Resources properties are thread safe.
Store and retrieve settings and other app data
App data is mutable data that is created and managed by a specific app. It includes runtime state, app settings, user preferences, reference content (such as the dictionary definitions in a dictionary app), and other settings. App data is different from user data, data that the user creates and manages when using an app. User data includes document or media files, email or communication transcripts, or database records holding content created by the user. User data may be useful or meaningful to more than one app. Often, this is data that the user wants to manipulate or transmit as an entity independent of the app itself, such as a document.
Important note about app data: The lifetime of the app data is tied to the lifetime of the app. If the app is removed, all of the app data will be lost as a consequence. Don’t use app data to store user data or anything that users might perceive as valuable and irreplaceable. We recommend that the user’s libraries and Microsoft OneDrive be used to store this sort of information. App data is ideal for storing app-specific user preferences, settings, and favorites.
Types of app data
There are two types of app data: settings and files.
Settings
Use settings to store user preferences and application state info. The app data API enables you to easily create and retrieve settings (we’ll show you some examples later in this article).
Here are data types you can use for app settings:
- UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double
- Boolean
- Char16, String
- DateTime, TimeSpan
- For C#/.NET, use: System.DateTimeOffset, System.TimeSpan
- GUID, Point, Size, Rect
- ApplicationDataCompositeValue: A set of related app settings that must be serialized and deserialized atomically. Use composite settings to easily handle atomic updates of interdependent settings. The system ensures the integrity of composite settings during concurrent access and roaming. Composite settings are optimized for small amounts of data, and performance can be poor if you use them for large data sets.
Files
Use files to store binary data or to enable your own, customized serialized types.
Storing app data in the app data stores
When an app is installed, the system gives it its own per-user data stores for settings and files. You don’t need to know where or how this data exists, because the system is responsible for managing the physical storage, ensuring that the data is kept isolated from other apps and other users. The system also preserves the contents of these data stores when the user installs an update to your app and removes the contents of these data stores completely and cleanly when your app is uninstalled.
Within its app data store, each app has system-defined root directories: one for local files, one for roaming files, and one for temporary files. Your app can add new files and new containers to each of these root directories.
Local app data
Local app data should be used for any information that needs to be preserved between app sessions and is not suitable for roaming app data. Data that is not applicable on other devices should be stored here as well. There is no general size restriction on local data stored. Use the local app data store for data that it does not make sense to roam and for large data sets.
Retrieve the local app data store
Before you can read or write local app data, you must retrieve the local app data store. To retrieve the local app data store, use the ApplicationData.LocalSettings property to get the app’s local settings as an ApplicationDataContainer object. Use the ApplicationData.LocalFolder property to get the files in a StorageFolder object. Use the ApplicationData.LocalCacheFolder property to get the folder in the local app data store where you can save files that are not included in backup and restore.
Create and retrieve a simple local setting
To create or write a setting, use the ApplicationDataContainer.Values property to access the settings in the localSettings container we got in the previous step. This example creates a setting named exampleSetting .
To retrieve the setting, you use the same ApplicationDataContainer.Values property that you used to create the setting. This example shows how to retrieve the setting we just created.
Create and retrieve a local composite value
To create or write a composite value, create an ApplicationDataCompositeValue object. This example creates a composite setting named exampleCompositeSetting and adds it to the localSettings container.
This example shows how to retrieve the composite value we just created.
Create and read a local file
To create and update a file in the local app data store, use the file APIs, such as Windows.Storage.StorageFolder.CreateFileAsync and Windows.Storage.FileIO.WriteTextAsync. This example creates a file named dataFile.txt in the localFolder container and writes the current date and time to the file. The ReplaceExisting value from the CreationCollisionOption enumeration indicates to replace the file if it already exists.
To open and read a file in the local app data store, use the file APIs, such as Windows.Storage.StorageFolder.GetFileAsync, Windows.Storage.StorageFile.GetFileFromApplicationUriAsync, and Windows.Storage.FileIO.ReadTextAsync. This example opens the dataFile.txt file created in the previous step and reads the date from the file. For details on loading file resources from various locations, see How to load file resources.
Roaming data
As of Windows 10, version 1909, it was announced that Package State Roaming (PSR) will be removed in a future update. PSR allows non-Microsoft developers to access roaming data on devices, enabling developers of UWP applications to write data to Windows and synchronize it to other instantiations of Windows for that user.
The recommended replacement for PSR is Azure App Service. Azure App Service is widely supported, well documented, reliable, and supports cross-platform/cross-ecosystem scenarios such as iOS, Android and web.
If you use roaming data in your app, your users can easily keep your app’s app data in sync across multiple devices. If a user installs your app on multiple devices, the OS keeps the app data in sync, reducing the amount of setup work that the user needs to do for your app on their second device. Roaming also enables your users to continue a task, such as composing a list, right where they left off even on a different device. The OS replicates roaming data to the cloud when it is updated, and synchronizes the data to the other devices on which the app is installed.
The OS limits the size of the app data that each app may roam. See ApplicationData.RoamingStorageQuota. If the app hits this limit, none of the app’s app data will be replicated to the cloud until the app’s total roamed app data is less than the limit again. For this reason, it is a best practice to use roaming data only for user preferences, links, and small data files.
Roaming data for an app is available in the cloud as long as it is accessed by the user from some device within the required time interval. If the user does not run an app for longer than this time interval, its roaming data is removed from the cloud. If a user uninstalls an app, its roaming data isn’t automatically removed from the cloud, it’s preserved. If the user reinstalls the app within the time interval, the roaming data is synchronized from the cloud.
Roaming data do’s and don’ts
- Use roaming for user preferences and customizations, links, and small data files. For example, use roaming to preserve a user’s background color preference across all devices.
- Use roaming to let users continue a task across devices. For example, roam app data like the contents of an drafted email or the most recently viewed page in a reader app.
- Handle the DataChanged event by updating app data. This event occurs when app data has just finished syncing from the cloud.
- Roam references to content rather than raw data. For example, roam a URL rather than the content of an online article.
- For important, time critical settings, use the HighPriority setting associated with RoamingSettings.
- Don’t roam app data that is specific to a device. Some info is only pertinent locally, such as a path name to a local file resource. If you do decide to roam local information, make sure that the app can recover if the info isn’t valid on the secondary device.
- Don’t roam large sets of app data. There’s a limit to the amount of app data an app may roam; use RoamingStorageQuota property to get this maximum. If an app hits this limit, no data can roam until the size of the app data store no longer exceeds the limit. When you design your app, consider how to put a bound on larger data so as to not exceed the limit. For example, if saving a game state requires 10KB each, the app might only allow the user store up to 10 games.
- Don’t use roaming for data that relies on instant syncing. Windows doesn’t guarantee an instant sync; roaming could be significantly delayed if a user is offline or on a high latency network. Ensure that your UI doesn’t depend on instant syncing.
- Don’t use roaming for frequently changing data. For example, if your app tracks frequently changing info, such as the position in a song by second, don’t store this as roaming app data. Instead, pick a less frequent representation that still provides a good user experience, like the currently playing song.
Roaming pre-requisites
Any user can benefit from roaming app data if they use a Microsoft account to log on to their device. However, users and group policy administrators can switch off roaming app data on a device at any time. If a user chooses not to use a Microsoft account or disables roaming data capabilities, she will still be able to use your app, but app data will be local to each device.
Data stored in the PasswordVault will only transition if a user has made a device «trusted». If a device isn’t trusted, data secured in this vault will not roam.
Conflict resolution
Roaming app data is not intended for simultaneous use on more than one device at a time. If a conflict arises during synchronization because a particular data unit was changed on two devices, the system will always favor the value that was written last. This ensures that the app utilizes the most up-to-date information. If the data unit is a setting composite, conflict resolution will still occur on the level of the setting unit, which means that the composite with the latest change will be synchronized.
When to write data
Depending on the expected lifetime of the setting, data should be written at different times. Infrequently or slowly changing app data should be written immediately. However, app data that changes frequently should only be written periodically at regular intervals (such as once every 5 minutes), as well as when the app is suspended. For example, a music app might write the «current song» settings whenever a new song starts to play, however, the actual position in the song should only be written on suspend.
Excessive usage protection
The system has various protection mechanisms in place to avoid inappropriate use of resources. If app data does not transition as expected, it is likely that the device has been temporarily restricted. Waiting for some time will usually resolve this situation automatically and no action is required.
Versioning
App data can utilize versioning to upgrade from one data structure to another. The version number is different from the app version and can be set at will. Although not enforced, it is highly recommended that you use increasing version numbers, since undesirable complications (including data loss)could occur if you try to transition to a lower data version number that represents newer data.
App data only roams between installed apps with the same version number. For example, devices on version 2 will transition data between each other and devices on version 3 will do the same, but no roaming will occur between a device running version 2 and a device running version 3. If you install a new app that utilized various version numbers on other devices, the newly installed app will sync the app data associated with the highest version number.
Testing and tools
Developers can lock their device in order to trigger a synchronization of roaming app data. If it seems that the app data does not transition within a certain time frame, please check the following items and make sure that:
- Your roaming data does not exceed the maximum size (see RoamingStorageQuota for details).
- Your files are closed and released properly.
- There are at least two devices running the same version of the app.
Register to receive notification when roaming data changes
To use roaming app data, you need to register for roaming data changes and retrieve the roaming data containers so you can read and write settings.
Register to receive notification when roaming data changes.
The DataChanged event notifies you when roaming data changes. This example sets DataChangeHandler as the handler for roaming data changes.
Get the containers for the app’s settings and files.
Create and retrieve roaming settings
Use the ApplicationDataContainer.Values property to access the settings in the roamingSettings container we got in the previous section. This example creates a simple setting named exampleSetting and a composite value named composite .
This example retrieves the settings we just created.
Create and retrieve roaming files
To create and update a file in the roaming app data store, use the file APIs, such as Windows.Storage.StorageFolder.CreateFileAsync and Windows.Storage.FileIO.WriteTextAsync. This example creates a file named dataFile.txt in the roamingFolder container and writes the current date and time to the file. The ReplaceExisting value from the CreationCollisionOption enumeration indicates to replace the file if it already exists.
To open and read a file in the roaming app data store, use the file APIs, such as Windows.Storage.StorageFolder.GetFileAsync, Windows.Storage.StorageFile.GetFileFromApplicationUriAsync, and Windows.Storage.FileIO.ReadTextAsync. This example opens the dataFile.txt file created in the previous section and reads the date from the file. For details on loading file resources from various locations, see How to load file resources.
Temporary app data
The temporary app data store works like a cache. Its files do not roam and could be removed at any time. The System Maintenance task can automatically delete data stored at this location at any time. The user can also clear files from the temporary data store using Disk Cleanup. Temporary app data can be used for storing temporary information during an app session. There is no guarantee that this data will persist beyond the end of the app session as the system might reclaim the used space if needed. The location is available via the temporaryFolder property.
Retrieve the temporary data container
Use the ApplicationData.TemporaryFolder property to get the files. The next steps use the temporaryFolder variable from this step.
Create and read temporary files
To create and update a file in the temporary app data store, use the file APIs, such as Windows.Storage.StorageFolder.CreateFileAsync and Windows.Storage.FileIO.WriteTextAsync. This example creates a file named dataFile.txt in the temporaryFolder container and writes the current date and time to the file. The ReplaceExisting value from the CreationCollisionOption enumeration indicates to replace the file if it already exists.
To open and read a file in the temporary app data store, use the file APIs, such as Windows.Storage.StorageFolder.GetFileAsync, Windows.Storage.StorageFile.GetFileFromApplicationUriAsync, and Windows.Storage.FileIO.ReadTextAsync. This example opens the dataFile.txt file created in the previous step and reads the date from the file. For details on loading file resources from various locations, see How to load file resources.
Organize app data with containers
To help you organize your app data settings and files, you create containers (represented by ApplicationDataContainer objects) instead of working directly with directories. You can add containers to the local, roaming, and temporary app data stores. Containers can be nested up to 32 levels deep.