Ejemplo n.º 1
0
        private void LocalPreferencesClick(object sender, RoutedEventArgs e)
        {
            if (!(MainTabControl.SelectedContent is Game))
            {
                return;
            }

            var game          = MainTabControl.SelectedContent as Game;
            var gametab       = MainTabControl.SelectedItem as TabItem;
            var content       = new GamePreferencesDialog(game.Preferences);
            var preferncestab = new TabItem {
                Header = string.Format("{0} \"{1}\"", Properties.Resources.LocalPreferencesHeader, gametab.Header), Content = content
            };

            content.LockGlobal();
            content.OkClicked +=
                preferences =>
            {
                MainTabControl.Items.Remove(preferncestab);
                game.Preferences = preferences;
                gametab.Header   = preferences.TabName;
            };
            content.CancelClicked += () => MainTabControl.Items.Remove(preferncestab);

            MainTabControl.Items.Add(preferncestab);
            MainTabControl.SelectedIndex = MainTabControl.Items.Count - 1;
        }
Ejemplo n.º 2
0
        private void GlobalPreferencesClick(object sender, RoutedEventArgs e)
        {
            var content       = new GamePreferencesDialog(new GamePreferences(_globalPreferences));
            var preferncestab = new TabItem {
                Header = Properties.Resources.GlobalPreferencesHeader, Content = content
            };

            content.OkClicked +=
                preferences =>
            {
                MainTabControl.Items.Remove(preferncestab);
                _globalPreferences = preferences;
            };
            content.CancelClicked += () => MainTabControl.Items.Remove(preferncestab);

            MainTabControl.Items.Add(preferncestab);
            MainTabControl.SelectedIndex = MainTabControl.Items.Count - 1;
        }