Exemplo n.º 1
0
        private static string AskForInput(UserInputOptions options)
        {
            var viewModel = new UserInputViewModel()
            {
                Message   = options.Message,
                Text      = options.DefaultText,
                Icon      = options.Icon,
                InputTest = options.InputTest
            };
            var window  = new System.Windows.Window();
            var control = new UserInputWindow()
            {
                window      = window,
                context     = viewModel,
                DataContext = viewModel,
            };

            window.Content               = control;
            window.Width                 = options.Width;
            window.WindowStyle           = System.Windows.WindowStyle.ThreeDBorderWindow;
            window.Height                = options.Height;
            window.Title                 = options.Title;
            window.ResizeMode            = System.Windows.ResizeMode.NoResize;
            window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            window.ShowDialog();

            return(viewModel.Text);
        }
Exemplo n.º 2
0
        private void carSelect_ItemClick(object sender, ItemClickEventArgs e)
        {
            System.Windows.Window wnd = new System.Windows.Window();
            wnd.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.OK, OnCompareCarSelect));
            System.Windows.ResourceDictionary res = new System.Windows.ResourceDictionary();
            res.BeginInit();
            res.Source = new Uri("pack://application:,,,/Assistant;component/Template/CarTypeSelector.xaml");
            res.EndInit();
            wnd.Style                 = res["carTypeSelector"] as System.Windows.Style;
            wnd.ShowInTaskbar         = false;
            wnd.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            CarTypeSelector selector = new CarTypeSelector();

            if (selectedNode != null)
            {
                selector.SelectedItem = selectedNode.Header;
            }

            wnd.Content     = selector;
            wnd.DataContext = selector;
            if (wnd.ShowDialog() == true)
            {
                selectedNode = selector.Tree.Children[0] as RuleCompareNode;
                comparer     = new RuleComparer(selectedNode, mainWebBrowser);
            }
        }
 public void Test()
 {
     System.Windows.Window Window = new System.Windows.Window();
     Window.Content     = new TablePanelTestContainer();
     Window.DataContext = new TablePanelTestContainerValues();
     Window.ShowDialog();
 }
        public void ShowViewWithMockServiceAndLoadedAppStorage()
        {
            AppBuilderView builderView = CreateViewAndViewModelViaMockService();
            WpfWindow      window      = CreateTestWindow(builderView);

            window.ShowDialog();
        }
        public void ShowViewWithIncreasingProgressOnMouseDoubleClick()
        {
            AppBuilderView builderView = CreateViewAndViewModelViaMockService();
            WpfWindow      window      = CreateTestWindow(builderView);

            window.MouseDoubleClick += (sender, e) => UpdateBuildProgress(builderView, 10);
            window.ShowDialog();
        }
Exemplo n.º 6
0
 /// <summary>
 ///		Muestra un cuadro de diálogo
 /// </summary>
 public SystemControllerEnums.ResultType ShowDialog(System.Windows.Window owner, System.Windows.Window view)
 {
     // Muestra el formulario activo
     view.Owner         = owner;
     view.ShowActivated = true;
     // Muestra el formulario y devuelve el resultado
     return(ConvertDialogResult(view.ShowDialog()));
 }
        public void ShowInfoDialogWhenNoSolutionProjectIsAvailableForContentProject()
        {
            AppBuilderView builderView = CreateViewAndViewModelViaMockService();
            WpfWindow      window      = CreateTestWindow(builderView);

            window.MouseDoubleClick += (sender, e) => service.ChangeProject("NonExistingProject");
            window.ShowDialog();
        }
        public void ShowViewWithMockServiceWithEngineContentProjects()
        {
            service.SetAvailableProjects("LogoApp", "GhostWars", "Insight", "DeltaEngine.Tutorials");
            AppBuilderView builderView = CreateViewAndViewModelViaMockService();
            WpfWindow      window      = CreateTestWindow(builderView);

            window.ShowDialog();
        }
        public void ShowViewWithMockServiceToVisualizeSwitchingBetweenBothLists()
        {
            AppBuilderView      builderView = CreateViewAndViewModelViaMockService();
            AppBuilderViewModel viewModel   = builderView.ViewModel;
            WpfWindow           window      = CreateTestWindow(builderView);

            window.MouseDoubleClick += (sender, e) => FireAppBuildMessagesOnMouseDoubleClick(e, viewModel);
            window.ShowDialog();
        }
Exemplo n.º 10
0
        public static void OpenWindow()
        {
            var w = new System.Windows.Window();

            w.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
            w.Content       = new TheCanvas();

            w.ShowDialog();
        }
Exemplo n.º 11
0
        public static Task <Microsoft.SharePoint.Client.ClientContext> GetAuthenticatedContext(string sharepointSiteUrl)
        {
            // see: https://stackoverflow.com/questions/15316613/when-should-taskcompletionsourcet-be-used

            var promise = new TaskCompletionSource <Microsoft.SharePoint.Client.ClientContext>();

            UseWPFThread(() =>
            {
                var win = new System.Windows.Window();

                var webBrowser = new WebBrowser();

                win.Content = webBrowser;

                webBrowser.Navigated += (_s, _args) =>
                {
                    var cookies = CookieReader.GetCookieCollection(_args.Uri)
                                  .OfType <Cookie>();

                    var FedAuth = cookies.FirstOrDefault(c => string.Equals("FedAuth", c.Name, StringComparison.OrdinalIgnoreCase));
                    var rtfa    = cookies.FirstOrDefault(c => string.Equals("rtFa", c.Name, StringComparison.OrdinalIgnoreCase));

                    if (FedAuth != null && rtfa != null)
                    {
                        // from: http://jcardy.co.uk/creating-a-sharepoint-csom-clientcontext-with-an-authentication-cookie/
                        var context = new Microsoft.SharePoint.Client.ClientContext(_args.Uri);
                        context.ExecutingWebRequest += (sender, e) =>
                        {
                            e.WebRequestExecutor.WebRequest.Headers[HttpRequestHeader.Cookie] = "FedAuth=" + FedAuth.Value + ";rtFa=" + rtfa.Value;
                        };

                        if (!promise.Task.IsCompleted)
                        {
                            promise.SetResult(context);
                        }

                        win.Close(); // we are done so close the window
                    }
                };

                win.Closed += (_s, _args) =>
                {
                    if (!promise.Task.IsCompleted)
                    {
                        throw new Exception("Window closed before got authentication");
                    }
                };


                // make this one of the last things that happens
                webBrowser.Navigate(sharepointSiteUrl);

                win.ShowDialog();
            });// end of wpf thread

            return(promise.Task);
        }
Exemplo n.º 12
0
		public void ShowParticleEditorViewInWindow()
		{
			var window = new Window
			{
				Title = "WPF Test - UserControl ParticleEditorView",
				Content = new ParticleEditorView()
			};
			window.ShowDialog();
		}
Exemplo n.º 13
0
        public void ShowParticleEditorViewInWindow()
        {
            var window = new Window
            {
                Title   = "WPF Test - UserControl ParticleEditorView",
                Content = new ParticleEditorView()
            };

            window.ShowDialog();
        }
Exemplo n.º 14
0
    protected override void OpenWindow(System.Windows.Window wnd)
    {
        //Do the pre open dialog method before showing the dialog
        _ViewModel.PreOpenDialog();
        //Show the dialog
        bool?result = wnd.ShowDialog();

        //Send the result to the post open dialog method.
        _ViewModel.PostOpenDialog(result);
    }
Exemplo n.º 15
0
        public bool ShowDialog(System.Windows.Window dialog, DTE dte)
        {
            var hwnd = dte.MainWindow.HWnd;

            var helper = new WindowInteropHelper(dialog);

            helper.Owner = new IntPtr(hwnd);

            return(dialog.ShowDialog() ?? false);
        }
Exemplo n.º 16
0
        public void ShowDialog(Window window)
        {
            var uiShell = (IVsUIShell)ServiceProvider.GetService(typeof(SVsUIShell));

            uiShell.EnableModeless(0);

            window.ShowDialog();

            uiShell.EnableModeless(1);
        }
Exemplo n.º 17
0
        public static bool?ShowHostDialog(this System.Windows.Window window)
        {
            Process process = Process.GetCurrentProcess();

            IntPtr mainWindowHandle = process.MainWindowHandle;

            var helper = new WindowInteropHelper(window);

            helper.Owner = mainWindowHandle;

            return(window.ShowDialog());
        }
Exemplo n.º 18
0
Arquivo: Ac.cs Projeto: 15831944/Geo7
        public static bool ShowModal(System.Windows.Window wnd)
        {
            wnd.ShowInTaskbar         = false;
            wnd.Topmost               = true;
            wnd.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            wnd.ResizeMode            = Windows.ResizeMode.NoResize; // This hides window Minimize/Maximize buttons

#if AutoCAD
            return(AcApp.ShowModalWindow(null, wnd, false).GetValueOrDefault(false));
#else
            return(wnd.ShowDialog().GetValueOrDefault(false));
#endif
        }
Exemplo n.º 19
0
 public override bool?ShowDialog(object rootModel, object context = null, IDictionary <string, object> settings = null)
 {
     System.Windows.Window window = CreateWindow(rootModel, true, context, settings);
     if (window == null)
     {
         return(false);
     }
     System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(window);
     helper.Owner              = Autodesk.Windows.ComponentManager.ApplicationWindow;
     window.SourceInitialized += Window_SourceInitialized;
     window.SizeChanged       += Window_SizeChanged;
     window.LocationChanged   += Window_LocationChanged;
     return(window.ShowDialog());
 }
Exemplo n.º 20
0
        public void ShowViewWithMockServiceAndDummyApps()
        {
            AppBuilderView      builderView = CreateViewAndViewModelViaMockService();
            AppBuilderViewModel viewModel   = builderView.ViewModel;

            viewModel.AppListViewModel.AddApp(
                AppBuilderTestExtensions.GetMockAppInfo("My favorite app", PlatformName.Windows));
            viewModel.AppListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo(
                                                  "My mobile app", PlatformName.Android));
            viewModel.AppListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo(
                                                  "My cool web app", PlatformName.Web));
            WpfWindow window = CreateTestWindow(builderView);

            window.ShowDialog();
        }
Exemplo n.º 21
0
        private Task <bool?> OpenDialogAsync(System.Windows.Window dialog)
        {
            if (_activeDialog is not null)
            {
                CloseDialog(_activeDialog);
            }

            _activeDialog = dialog;
            _activeDialog.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            if (System.Windows.Application.Current.MainWindow != null && System.Windows.Application.Current.MainWindow.IsLoaded)
            {
            }
            _activeDialog.Owner = System.Windows.Application.Current.MainWindow;

            return(Task.FromResult(_activeDialog.ShowDialog()));
        }
Exemplo n.º 22
0
        internal bool?InternalShowModalWindow(System.Windows.Window window)
        {
            if (null == window)
            {
                throw new ArgumentNullException(nameof(window));
            }

            window.Owner = TopmostModalWindow;
            _modalWindows.Push(window);
            try
            {
                return(window.ShowDialog());
            }
            finally
            {
                _modalWindows.Pop();
            }
        }
Exemplo n.º 23
0
 protected override void EndJob(JobHandle job)
 {
     try
     {
         if (_canvas != null)
         {
             Window window = new Window();
             window.Content             = _canvas;
             window.Title               = job.Context.GraphName;
             window.SnapsToDevicePixels = true;
             window.ShowDialog();
         }
     }
     finally
     {
         _canvas = null;
     }
 }
Exemplo n.º 24
0
 public static System.Windows.Window createMainWindow(Type window, bool dialogBox = false)
 {
     System.Windows.Window temp = views.Find(name => name.GetType().Equals(window));
     if (temp == null)
     {
         temp = (System.Windows.Window)Activator.CreateInstance(window);
         views.Add(temp);
     }
     temp.Closed += onClose;
     if (dialogBox)
     {
         temp.ShowDialog();
     }
     else
     {
         temp.Show();
     }
     temp.Focus();
     return(temp);
 }
        private void OpenOrganizerFunc(object param)
        {
            var organizerVM   = new ComponentLibraryOrganizerVM(m_componentsLibraryViewModel);
            var organizerView = new TraceLab.UI.WPF.Views.ComponentLibraryOrganizer();

            organizerView.DataContext = organizerVM;

            var organizerWindow = new System.Windows.Window();

            organizerWindow.Content = organizerView;
            foreach (System.Windows.Window window in System.Windows.Application.Current.Windows)
            {
                if (window.IsKeyboardFocusWithin)
                {
                    organizerWindow.Owner = window;
                }
            }
            organizerWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            organizerWindow.ShowActivated         = true;
            organizerWindow.Title = "Component Tags Organizer";
            organizerWindow.Icon  = new BitmapImage(new Uri("pack://application:,,,/TraceLab.UI.WPF;component/Resources/Icon_Organizer16.png"));
            organizerWindow.ShowDialog();
        }
Exemplo n.º 26
0
 static void Main(string[] args)
 {
     System.Windows.Window 視窗物件 = new System.Windows.Window();
     視窗物件.ShowDialog();
 }
Exemplo n.º 27
0
 public static void ShowDialogInScreen(this System.Windows.Window win)
 {
     SetScreen(win);
     win.ShowDialog();
 }
Exemplo n.º 28
0
 static void Main(string[] args)
 {
     System.Windows.Window window = new System.Windows.Window();
     window.ShowDialog();
 }
 public void Test()
 {
     System.Windows.Window Window = new System.Windows.Window();
     Window.Content = new ContentUnavailableTestContainer();
     Window.ShowDialog();
 }
        private void OpenOrganizerFunc(object param)
        {
            var organizerVM = new ComponentLibraryOrganizerVM(m_componentsLibraryViewModel);
            var organizerView = new TraceLab.UI.WPF.Views.ComponentLibraryOrganizer();
            organizerView.DataContext = organizerVM;

            var organizerWindow = new System.Windows.Window();
            organizerWindow.Content = organizerView;
            foreach(System.Windows.Window window in System.Windows.Application.Current.Windows)
            {
                if(window.IsKeyboardFocusWithin)
                {
                    organizerWindow.Owner = window;
                }
            }
            organizerWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            organizerWindow.ShowActivated = true;
            organizerWindow.Title = "Component Tags Organizer";
            organizerWindow.Icon = new BitmapImage(new Uri("pack://application:,,,/TraceLab.UI.WPF;component/Resources/Icon_Organizer16.png"));
            organizerWindow.ShowDialog();
        }
Exemplo n.º 31
0
 protected void OpenWindow(object obj)
 {
     System.Windows.Window creationWindow = obj as System.Windows.Window;
     creationWindow.Owner = System.Windows.Application.Current.MainWindow;
     creationWindow.ShowDialog();
 }
Exemplo n.º 32
0
 protected override void EndJob(JobHandle job)
 {
     try
     {
         if (_canvas != null)
         {
             Window window = new Window();
             window.Content = _canvas;
             window.Title = job.Context.GraphName;
             window.SnapsToDevicePixels = true;
             window.ShowDialog();
         }
     }
     finally
     {
         _canvas = null;
     }
 }