Пример #1
0
        private void profiles_Click(object sender, RoutedEventArgs e)
        {
            // Open the custom profiles dialog
            state.SelectedProfile = view.SelectedProfile;
            var w = new ProfilesWindow(state);

            w.Owner = this;
            w.ShowDialog();
            view.RefreshProfiles();
            view.SelectedProfile = state.SelectedProfile;
        }
Пример #2
0
        // Constructor
        public ProfilesView(ProfilesWindow window, State state)
        {
            this.window = window;
            this.state  = state;

            //  Make a working copy of the custom profiles so that we can discard edits later, if we are cancelled
            foreach (var p in state.CustomProfiles)
            {
                var editableProfile = p.CreateClone();
                editableProfile.Original = p;
                editableProfiles.Add(editableProfile);
                if (p == state.SelectedProfile)
                {
                    SelectedProfile = editableProfile;
                }
            }

            // Reflect the profile selected in the main window, if possible
            if (state.SelectedProfile != null && state.SelectedProfile.IsReadOnly)
            {
                SelectedProfile = state.SelectedProfile;
            }
        }