Beispiel #1
0
        private void OpenProfileWindow(Profile profile)
        {
            void ShowAction()
            {
                var win = new ProfileWindow(Context, profile);

                ProfileWindows.Add(win.ProfileGuid, win);
                win.Closed += OnProfileWindowClosed;
                win.Focus();
                win.Show();
                var restoreFocusDialogClose = RootDialog.GetType().GetField("_restoreFocusDialogClose", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

                restoreFocusDialogClose?.SetValue(RootDialog, null);
            }

            Dispatcher.BeginInvoke((Action)ShowAction);
        }
Beispiel #2
0
        private void EditProfile(object sender, RoutedEventArgs e)
        {
            if (sender is TreeViewItem)
            {
                if (!((TreeViewItem)sender).IsSelected)
                {
                    return;
                }
            }
            ProfileItem pi;

            if (!GetSelectedItem(out pi))
            {
                return;
            }
            var    win        = new ProfileWindow(context, pi.profile);
            Action showAction = () => win.Show();

            Dispatcher.BeginInvoke(showAction);
        }