Ejemplo n.º 1
0
        private void WindowLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            string key  = string.Format("{0}.Settings", this.appWindow.Name);
            string json = this.userSettingService.GetUserSetting <string>(key);

            if (!string.IsNullOrEmpty(json))
            {
                WindowInformation settings = JsonConvert.DeserializeObject <WindowInformation>(json);
                this.appWindow.WindowState = settings.WindowState;
            }
        }
Ejemplo n.º 2
0
        private void WindowClosing(object sender, CancelEventArgs cancelEventArgs)
        {
            string            key         = string.Format("{0}.Settings", this.appWindow.Name);
            WindowInformation information = new WindowInformation(this.appWindow.Name, this.appWindow.WindowState, this.appWindow.RestoreBounds);

            string json = JsonConvert.SerializeObject(information, Formatting.Indented);

            if (!string.IsNullOrEmpty(json))
            {
                this.userSettingService.SetUserSetting(key, json);
            }
        }
Ejemplo n.º 3
0
        private void WindowInitialized(object sender, EventArgs eventArgs)
        {
            string key  = string.Format("{0}.Settings", this.appWindow.Name);
            string json = this.userSettingService.GetUserSetting <string>(key);

            if (!string.IsNullOrEmpty(json))
            {
                WindowInformation settings = JsonConvert.DeserializeObject <WindowInformation>(json);

                if (settings.Location != Rect.Empty)
                {
                    // We might use these in the future
                    this.appWindow.Left   = settings.Location.Left;
                    this.appWindow.Top    = settings.Location.Top;
                    this.appWindow.Width  = settings.Location.Width;
                    this.appWindow.Height = settings.Location.Height;
                }

                if (settings.WindowState != WindowState.Maximized)
                {
                    this.appWindow.WindowState = settings.WindowState;
                }
            }
        }