public void ShowDialog()
    {
      object view = Context.Container.ResolveView(this.GetType());
      if (view != null)
      {
        if (view is Window)
        {
          Window window = (Window)view;
          window.DataContext = this;
          window.ShowDialog();
        }
        else if (view is FrameworkElement)
        {
          Window window = new Window();
          window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
          window.ResizeMode = ResizeMode.NoResize;
          window.SizeToContent = SizeToContent.WidthAndHeight;
          window.ShowInTaskbar = false;
          window.Topmost = true;

          FrameworkElement control = (FrameworkElement)view;
          window.Height = control.Height;
          window.Width = control.Width;
          window.Content = control;
          control.DataContext = this;
          window.ShowDialog();
        }
      }
    }
Example #2
1
        private static void CreateWindowInstance(ControlTestRequest request, ManualResetEventSlim evt) {
            try {
                Window = new Window();

                if (Screen.AllScreens.Length == 1) {
                    Window.Left = 0;
                    Window.Top = 50;
                } else {
                    Screen secondary = Screen.AllScreens.FirstOrDefault(x => !x.Primary);
                    Window.Left = secondary.WorkingArea.Left;
                    Window.Top = secondary.WorkingArea.Top + 50;
                }

                Window.Width = 800;
                Window.Height = 600;

                Component = Activator.CreateInstance(request.ControlType);
                if (Component is Control) {
                    Control = Component as Control;
                } else {
                    Control = Component.GetType().GetProperty("Control").GetValue(Component) as Control;
                }

                Window.Title = "Control - " + request.ControlType;
                Window.Content = Control;
            } finally {
                evt.Set();
            }

            Window.Topmost = true;
            Window.ShowDialog();
        }
Example #3
0
 void DisplayClosingDialog(Window dlgWnd)
 {
     if (dlgWnd == null)
         return;
     CloseIfUnchanged();
     dlgWnd.ShowDialog();
 }
Example #4
0
 private void GenericShowDialog(Window window)
 {
     this.Hide();
     window.Owner = this;
     window.ShowDialog();
     this.Close();
 }
Example #5
0
        /// <summary>
        /// ウィンドウをダイアログとして表示します。
        /// </summary>
        /// <param name="type">表示するダイアログウィンドウに対する DataContext の Type 情報を指定します。</param>
        public void ShowDialog(string windowName)
        {
            if (windowName == null)
            {
                return;
            }

            System.Windows.Window     vw = null;
            KeyValuePair <Type, Type> pair;

            if (_windowMap.TryGetValue(windowName, out pair))
            {
                var vwType = pair.Key;
                var vmType = pair.Value;

                vw = CrateWindowInstance(vwType, vmType);

                if (vw != null)
                {
                    views.Add(vw);
                    vw.ShowDialog();
                    views.Remove(vw);
                }
            }
        }
        private void btnRun_Click(object sender, RoutedEventArgs e)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\..\..\..\Data\ImageSample.xls");
            Worksheet sheet = workbook.Worksheets[0];
            //get picture
            ExcelPicture pic = sheet.Pictures[0];

            //save memoryStream
            System.Windows.Controls.Image img = new System.Windows.Controls.Image();
            System.IO.MemoryStream mem = new System.IO.MemoryStream();
            pic.Picture.Save(mem, System.Drawing.Imaging.ImageFormat.Png);
            img.Source = GetBitmapSourceFromStream(mem);
            //create window
            Window imgWindow = new Window();
            imgWindow.Title = "ImageSample";
            imgWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            imgWindow.Width = pic.Picture.Width;
            imgWindow.Height = pic.Picture.Height;
            imgWindow.ResizeMode = ResizeMode.NoResize;
            //set margin
            Thickness thick = new Thickness(0,0,0,0);
            img.Margin = thick;
            imgWindow.Content = img;
            imgWindow.ShowDialog();
        }
        private void returnUnderlyingCalcSetBtn_Click(object sender, RoutedEventArgs e)
        {
            Window w = new Window();
            w.Width = 500;
            w.Height = 200;

            Excel_underlyingCalcIDLoaderView e_ucIDlv = this.viewModel_.Excel_underlyingCalcIDViewModel_.loaderView();

            //e_ucIDlv.Excel_underlyingCalcInfoViewModel_ = this.viewModel_.Excel_underlyingCalcInfoViewModel_;

            //e_ucIDlv.SelectedUnderCalcIDTypeViewModel_ = this.viewModel_.Excel_underlyingCalcIDViewModel_.Clone();

            w.Content = e_ucIDlv;

            if (w.ShowDialog() == true)
            {

                this.viewModel_.Excel_underlyingCalcIDViewModel_
                    = e_ucIDlv.SelectedUnderCalcIDTypeViewModel_;

                this.viewModel_.Excel_underlyingCalcIDViewModel_.descriptionUpdate();

                this.returnUnderCalcDescriptionTxb_.Text = this.viewModel_.Excel_underlyingCalcIDViewModel_.Description_;
            }
            else
            {

            }

        }
Example #8
0
        private void ShowDialog(Window dialog, Action<bool> onClosed, bool subDialog)
        {
            dialog.Closed += (sender, args) =>
            {
                _WindowStack.Pop();

                if (onClosed != null)
                {
                    onClosed(dialog.DialogResult ?? false);
                }
            };

            if (subDialog && _WindowStack.Count > 0)
            {
                dialog.Owner = _WindowStack.Peek();
                dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

                var mask = new SolidColorBrush(Colors.White);
                mask.Opacity = 0.5;

                _WindowStack.Peek().OpacityMask = mask;
            }

            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            _WindowStack.Push(dialog);

            dialog.ShowDialog();

            if (_WindowStack.Count > 0)
            {
                _WindowStack.Peek().OpacityMask = null;
            }
        }
 private void button_Click(object sender, RoutedEventArgs e)
 {
     Button button = (Button)e.Source;
     if (button.Content.ToString() != "Close")
     {
         Type type = this.GetType();
         Assembly assembly = type.Assembly;
         object o = assembly.CreateInstance(type.Namespace + "." + button.Content);
         if (o is Window)
         {
             Window window = (Window)o;
             window.ShowDialog();
         }
         else if (o is Page)
         {
             Page p = (Page)o;
             Window w = new Window();
             w.Content = p;
             w.ShowDialog();
         }
     }
     else
     {
         this.Close();
     }
 }
Example #10
0
    private void OnAddView(object sender, ExecutedRoutedEventArgs e)
    {
      try
      {

        if (Bcfier.SelectedBcf() == null)
          return;
        var issue = e.Parameter as Markup;
        if (issue == null)
        {
          MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
          return;
        }

        var addView = new AddView(issue, Bcfier.SelectedBcf().TempPath);
        var win = new Window
        {
          Content = addView,
          Title = "Add View",
          SizeToContent = SizeToContent.WidthAndHeight,
          WindowStartupLocation = WindowStartupLocation.CenterScreen
        };
        win.ShowDialog();
        if (win.DialogResult.HasValue && win.DialogResult.Value)
          Bcfier.SelectedBcf().HasBeenSaved = false;

      }
      catch (System.Exception ex1)
      {
        MessageBox.Show("exception: " + ex1);
      }
    }
Example #11
0
		public static Duration GetDuration(string fileName)
			{
			Duration naturalDuration = Duration.Automatic;
			Window w = new Window
				{
				Content = _videoElement = new MediaElement() { IsMuted = true },
				IsHitTestVisible = false,
				Width = 0,
				Height = 0,
				WindowStyle = WindowStyle.None,
				ShowInTaskbar = false,
				ShowActivated = false
				};
			_videoElement.MediaOpened += (sender, args) =>
				{
				naturalDuration = _videoElement.NaturalDuration;
				_videoElement.Close();
				w.Close();
				};
			_videoElement.LoadedBehavior = MediaState.Manual;
			_videoElement.UnloadedBehavior = MediaState.Manual;
			_videoElement.Source = new Uri(fileName);
			_videoElement.Play();
			w.ShowDialog();
			return naturalDuration;
			}
        private void typeEditBtn_Click(object sender, RoutedEventArgs e)
        {
            Window w = new Window();
            w.Width = 500;
            w.Height = 200;

            // 우선 loader 말고 그냥 박음.. listVM class 에서 refresh해야하는데 복잡허네..

            //Excel_scheduleLoaderView e_slv = new Excel_scheduleLoaderView();

            //e_slv.Excel_underlyingCalcInfoViewModel_ = this.viewModel_.Excel_underlyingCalcInfoViewModel_;

            Excel_couponScheduleViewModel selectedVM = this.CouponScheduleDataGrid_.SelectedItem as Excel_couponScheduleViewModel;

            // 그냥 우선은 수정 불가로 해놓자으

            //e_slv.SelectedScheduleTypeViewModel_ = selectedVM;
            
            w.Content = selectedVM.loaderView();

            if (w.ShowDialog() == true)
            {
                //this.viewModel_.Excel_scheduleViewModel_[selectedIndex] = selectedVM;

                selectedVM.descriptionUpdate();

            }
            else
            {

            }
        }
        private void EditAddressBook_Click(object sender, RoutedEventArgs e)
        {
            // Manually create window
            Window wnd = new Window();
            wnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            wnd.Owner = Application.Current.MainWindow;
            wnd.Title = Properties.Resources.AddressBookWindowTitle;
            wnd.Icon = BitmapFrame.Create(this.GetPackUri("Images/AddressBook_16.png"));
            wnd.Closing += (a, b) =>
            {
                var result = MessageBox.Show(Properties.Resources.AddressBookWindowLeaveConfirmation_MSG, Properties.Resources.AddressBookWindowLeaveConfirmation_CAP, MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                if (result == MessageBoxResult.Cancel)
                {
                    b.Cancel = true;
                    return;
                }

                wnd.DialogResult = (result == MessageBoxResult.Yes) ? true : false;
            };

            AddressBookEditorControl editorctrl = new AddressBookEditorControl();
            editorctrl.ValueWrapper = _valueRaw;
            wnd.Content = editorctrl;

            if (wnd.ShowDialog() == true)
            {
                _valueRaw = editorctrl.ValueWrapper;
            }
        }
Example #14
0
    private static void Main() {
      var builder = new ContainerBuilder();

      builder.RegisterModule<Profiler>();

      builder.RegisterType<List<string>>().As<IEnumerable<string>>();

      builder.RegisterGeneric(typeof(BinaryTree<>)).As(typeof(ITree<>));
      builder.Register(c => new TreeWrapper(c.Resolve<ITree<int>>(), c.Resolve<IEnumerable<string>>()));

      builder.RegisterType<UsesInt>().As<IGiveString>().Named<object>("My Name");
      builder.RegisterType<UsesString>().As<IGiveString>();

      builder.Register(c => "hello");
      builder.Register(c => 7);

      using (var container = builder.Build()) {

        var vm = new VisualizerViewModel(new TestContainerInfo(container));
        var window = new Window {
          Content = new VisualizerControl(vm) {
            HorizontalAlignment = HorizontalAlignment.Stretch,
            VerticalAlignment = VerticalAlignment.Stretch
          },
          Width = 600,
          Height = 600
        };
        window.ShowDialog();
        //AutofacVisualizer.VS2010.VisualizerDialog.TestShowVisualizer(container);
      }
    }
 private void ReactiveProperty_Click(object sender, RoutedEventArgs e)
 {
     Window window = new Window { Content = new UsingReactivePropertyView()};
     window.Height = 400;
     window.Width = 500;
     window.ShowDialog();
 }
Example #16
0
        private void btn_baidu_login_Click(object sender, RoutedEventArgs a)
        {
            var b = new System.Windows.Forms.WebBrowser();

            b.Width           = 800;
            b.Height          = 600;
            b.AllowNavigation = true;
            var w = new System.Windows.Window();

            b.Navigated += (s, e) =>
            {
                try
                {
                    var m = new Regex("access_token=(.*?)&").Match(e.Url.ToString());
                    if (m.Success)
                    {
                        Global.AppSettings["baidu_access_token"] = m.Groups[1].Value;
                        w.Close();
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            };
            b.Navigate(new PCS_client().GetAccessTokenPage());
            var h = new System.Windows.Forms.Integration.WindowsFormsHost();

            h.Child   = b;
            w.Content = h;
            w.ShowDialog();
        }
 private void WpfPropertyandCommand_Click(object sender, RoutedEventArgs e)
 {
     Window window = new Window { Content = new UsingWpfPropertyCommandView() };
     window.Height = 400;
     window.Width = 500;
     window.ShowDialog();
 }
Example #18
0
 public void showWindow(object viewModel)
 {
     var window = new Window();
     window.Content = viewModel;
     window.Owner = Application.Current.MainWindow;
     window.ShowDialog();
 }
Example #19
0
        public override void CustomExecute(object parameter)
        {
            try
            {
                IGlobal      global = Autodesk.Max.GlobalInterface.Instance;
                IInterface14 ip     = global.COREInterface14;

                int nNumSelNodes = ip.SelNodeCount;
                if (nNumSelNodes <= 0)
                {
                    ip.PushPrompt("No nodes are selected. Please select at least one node to convert, before running the command.");
                    return;
                }

                System.Windows.Window dialog = new System.Windows.Window();
                dialog.Title         = "Explode It!";
                dialog.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
                ExplodeGeomUserControl1 ctlExplode = new ExplodeGeomUserControl1(dialog);
                dialog.Content = ctlExplode;
                dialog.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                dialog.ShowInTaskbar         = false;
                dialog.ResizeMode            = System.Windows.ResizeMode.NoResize;

                System.Windows.Interop.WindowInteropHelper windowHandle =
                    new System.Windows.Interop.WindowInteropHelper(dialog);
                windowHandle.Owner = ManagedServices.AppSDK.GetMaxHWND();
                ManagedServices.AppSDK.ConfigureWindowForMax(dialog);

                dialog.ShowDialog(); //modal version; this prevents changes being made to model while our dialog is running, etc.
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
Example #20
0
        public void CreateTestWindow()
        {
            Application.ResourceAssembly = typeof (InsertGistControl).Assembly;

            WpfHelper.RunBlockAsSTA(() => {
                var grid = new Grid();
                var lhs = new ColumnDefinition() {Width = new GridLength(0.5, GridUnitType.Star)};
                var rhs = new ColumnDefinition() {Width = new GridLength(0.5, GridUnitType.Star)};
                grid.ColumnDefinitions.Add(lhs);    grid.ColumnDefinitions.Add(rhs);

                var textBox = new TextBox();
                var control = new InsertGistControl() {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                };

                Grid.SetColumn(textBox, 0);
                Grid.SetColumn(control, 1);
                textBox.TextChanged += (o, e) => control.ViewModel.SelectionText = textBox.Text;
                grid.Children.Add(textBox); grid.Children.Add(control);

                var wnd = new Window() {
                    Content = grid,
                };

                wnd.ShowDialog();
            });
        }
Example #21
0
        private const int WS_SYSMENU = 0x80000; //WPF's Message code for System Menu

        #endregion Fields

        #region Methods

        public static bool Modal(Window win, Window parent, bool dimParent = true, bool removeTitlebarMenu = true)
        {
            win.Owner = parent;

            if (removeTitlebarMenu)
            {
                win.Loaded += (s, e) =>
                {
                    var hwnd = new WindowInteropHelper(win).Handle;
                    SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
                };
            }

            if (dimParent && parent != null)
            {
                DimAllTheThings(parent);
            }

            var ret = win.ShowDialog() ?? false;

            if (dimParent && parent != null)
            {
                UnDimAllTheThings(parent);
            }

            return ret;
        }
Example #22
0
        private void Login(System.Windows.Window loginView)
        {
            //  ログイン画面が閉じられた時にアプリケーションが終了しないよう、OnExplicitShutdownを設定しておく
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var isLoggedin      = loginView.ShowDialog() ?? false;
            var isAuthenticated = Thread.CurrentPrincipal.Identity.IsAuthenticated;

            if (isLoggedin && isAuthenticated)
            {
                //  MainWindowが閉じられた時にアプリケーションが終了するように変更
                Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

                var vm = new LoggedinViewModel();
                vm.UserName = Thread.CurrentPrincipal.Identity.Name;

                var loggedinView = new LoggedinView();
                loggedinView.DataContext = vm;

                Current.MainWindow = loggedinView;
                loggedinView.ShowDialog();
            }
            else
            {
                //  OnExplicitShutdownの場合、明示的なShutdown()呼び出しが必要
                Current.Shutdown(-1);
            }
        }
Example #23
0
 public bool? ShowDialog(Window dialog)
 {
     HideDialogs();
     modalDialog = dialog;
     bool? r = dialog.ShowDialog();
     modalDialog = null;
     return r;
 }
Example #24
0
 protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
 {
     var window = new Window
     {
         Content = new View((IEnumerable<object>) objectProvider.GetObject())
     };
     window.ShowDialog();
 }
Example #25
0
 private void ShowDialog(Window window)
 {
     if (window == null)
     {
         window.Closed += (o, args) => window = null;
     }
     window.ShowDialog();
 }
        public static bool? ShowDialog(Window window)
        {
            ShowingDialogCount++;
             var result = window.ShowDialog();
            ShowingDialogCount--;

            return result;
        }
Example #27
0
 private static void ShowXpsPreview(XpsDocument xpsDocument)
 {
     var previewWindow = new Window();
     var docViewer = new DocumentViewer();
     previewWindow.Content = docViewer;
     docViewer.Document = xpsDocument.GetFixedDocumentSequence();
     previewWindow.ShowDialog();
 }
Example #28
0
        void WindowOnMouseDown(object sender, MouseButtonEventArgs args)
        {
            Window win = new Window();
            win.Title = "Modal Dialog Box";
            win.ShowDialog();

            Window mainWin = sender as Window;
            mainWin.Title = "Main : " + Windows.Count;
        }
Example #29
0
 public static void ShowDialog(ViewModelBase viewModel, double width, double height)
 {
     Window window = new Window();
     window.Content = new ContentPresenter { Content = viewModel };
     window.Title = viewModel.DisplayName;
     window.Width = width;
     window.Height = height;
     window.ShowDialog();
 }
 public void ShowParticleEditorViewInWindow()
 {
     var window = new Window
     {
         Title = "WPF Test - UserControl ParticleEditorView",
         Content = new ParticleEditorView()
     };
     window.ShowDialog();
 }
		public void ShowMaterialEditorInWindow()
		{
			var window = new Window
			{
				Title = "My User Control Dialog",
				Content = new LevelEditorView()
			};
			window.ShowDialog();
		}
		public void OnEditScheme()
		{
			EditFilterView editFilterView = new EditFilterView();
			editFilterView.ViewModel.Run(SelectedFilterScheme, _instanceProperties, Save);
			Window window = new Window();
			window.Title = "Edit Filter";
			window.Content = editFilterView;
			window.ShowDialog();
		}
Example #33
0
        public static void Show(System.Windows.Controls.UserControl WPFUserControl, string title, string sound, bool topmost, bool isModal)
        {
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);

            //Create window
            System.Windows.Window wnd = new System.Windows.Window();
            wnd.Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);
            wnd.Title = title;

            //Set window style
            try
            {
                wnd.Style = wnd.FindResource("StyleWindowMessage") as Style;
            }
            catch
            {
                //Set default style
                wnd.WindowStyle = WindowStyle.None;
                wnd.AllowsTransparency = true;
                wnd.Background = new SolidColorBrush(Colors.Transparent);
                wnd.ResizeMode = ResizeMode.NoResize;
                wnd.ShowInTaskbar = false;
            }

            object media = wnd.TryFindResource("media");
            if(media != null && media is MediaElement)
            {
                MediaElement mediaElement = media as MediaElement;
                object showSound = wnd.TryFindResource("ShowWindowSound");
                if(showSound != null && showSound is MediaTimeline)
                {
                    mediaElement.LoadedBehavior = MediaState.Manual;
                    mediaElement.UnloadedBehavior = MediaState.Manual;
                    mediaElement.Source = new Uri("pack://application:,,,/SlideWindow;component/show.wav", UriKind.Absolute);//((MediaTimeline)showSound).Source;
                    mediaElement.Volume = 5;
                    mediaElement.Position = new TimeSpan(0);
                }
                mediaElement.Play();
            }

            //Add WPFUserControl to window
            wnd.Content = WPFUserControl;

            //Set parameters
            wnd.Topmost = topmost;

            //Play sound after showing (set delay for sound)

            //Show window
            if(isModal)
                wnd.ShowDialog();
            else
                wnd.Show();

            wnd = null;
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
        }
Example #34
0
 private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
 {
     Window window = new Window();
     window.Title = "Popup window";
     window.Owner = this;
     window.Height = 50;
     window.Width = 90;
     window.ShowDialog();
 }
Example #35
0
 protected override void OnClick()
 {
     base.OnClick();
     System.Windows.Window window = Activator.CreateInstance(this.UserWindowType) as System.Windows.Window;
     if (window != null)
     {
         window.ShowDialog();
     }
 }
        private void OpenWindow(string windowSource)
        {
            Type   userType         = Type.GetType("OfficeEquipmentManager." + windowSource);
            object navigationSource = Activator.CreateInstance(userType);

            System.Windows.Window window = (navigationSource as System.Windows.Window);
            CurrentWindow = window;
            window.ShowDialog();
        }
Example #37
0
        private void OpenSettings(object sender, RoutedEventArgs e)
        {
            UCSettings settings = new UCSettings();
            Window     w        = new Window()
            {
                DataContext   = myVM,
                Content       = settings,
                SizeToContent = SizeToContent.Height,
                Width         = 300,
                Title         = "Settings"
            };

            w.ShowDialog();
        }
Example #38
0
        private void CreateDiffWindow(string title)
        {
            var diffCtrl = new DiffControl();

            diffCtrl.DataContext = this;
            CloseDialog();
            DialogWindow = new System.Windows.Window {
                MinHeight = 150, MinWidth = 150
            };
            DialogWindow.Title       = title;
            DialogWindow.Content     = diffCtrl;
            DialogWindow.DataContext = this;
            DialogWindow.ShowDialog();
        }
        public bool?ShowModalMessageWindow(string title, string message)
        {
            var window = new System.Windows.Window();

            window.Content = new MessageDialog(title, message, b => window.DialogResult = b, true)
            {
                Margin = new Thickness(10)
            };

            window.SizeToContent         = SizeToContent.WidthAndHeight;
            window.ResizeMode            = ResizeMode.NoResize;
            window.Owner                 = System.Windows.Application.Current.MainWindow;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.WindowStyle           = WindowStyle.ToolWindow;
            window.ShowInTaskbar         = false;

            OnWindowConstructed?.Invoke(window);

            return(window.ShowDialog());
        }
Example #40
0
 public bool?ShowDialogWithModel(System.Windows.Window view, DialogType dialogType, DialogViewModel viewModel)
 {
     if (view == null)
     {
         throw new ArgumentNullException("view");
     }
     view.Owner = this.Window;
     view.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     view.ShowInTaskbar         = false;
     if (viewModel != null)
     {
         viewModel.Init();
         view.DataContext = viewModel;
     }
     if (dialogType == DialogType.Modal)
     {
         return(view.ShowDialog());
     }
     view.Show();
     return(null);
 }
Example #41
0
        private void OnButtonClick(object sender, EventArgs e)
        {
            Xceed.Wpf.Toolkit.Wizard wizard = this.Resources["_wizard"] as Xceed.Wpf.Toolkit.Wizard;
            if (wizard != null)
            {
                wizard.CurrentPage = wizard.Items[0] as Xceed.Wpf.Toolkit.WizardPage;

                if (_window != null)
                {
                    _window.Content = null;
                    _window         = null;
                }
                _window         = new System.Windows.Window();
                _window.Title   = "Wizard demonstration";
                _window.Content = wizard;
                _window.Width   = 600;
                _window.Height  = 400;
                _window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                // Window will be closed by Wizard because FinishButtonClosesWindow = true and CancelButtonClosesWindow = true
                _window.ShowDialog();
            }
        }
Example #42
0
        /// <summary>
        /// Launches the variable exporter and passes in the debugger variable.
        /// </summary>
        /// <param name="sender">event source</param>
        /// <param name="e">event arguments</param>
        private void _root_Export(object sender, RoutedEventArgs e)
        {
            if (currentExpression == null)
            {
                return;
            }

            var exporterControl = new VariableExporter();

            exporterControl.Expression = currentExpression;

            var dialogWindow = new System.Windows.Window()
            {
                Title      = "Variable Exporter",
                Content    = exporterControl,
                Width      = 500,
                Height     = 300,
                ResizeMode = ResizeMode.NoResize
            };

            dialogWindow.ShowDialog();
        }
Example #43
0
        private void OpenSettingsFunc(object param)
        {
            var settingsView = new TraceLab.UI.WPF.Views.SettingsPage();

            settingsView.DataContext = SettingsViewModel;

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

            settingsWindow.Content = settingsView;
            SetWindowOwner(settingsWindow);
            settingsWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            settingsWindow.ShowActivated         = true;
            settingsWindow.Title         = "Settings";
            settingsWindow.Icon          = new BitmapImage(new Uri("pack://application:,,,/TraceLab.UI.WPF;component/Resources/Icon_Settings16.png"));
            settingsWindow.ResizeMode    = ResizeMode.NoResize;
            settingsWindow.SizeToContent = SizeToContent.WidthAndHeight;

            bool?result = settingsWindow.ShowDialog();

            if (result == true)
            {
                SettingsViewModel.ApplyChanges();
            }
        }
Example #44
0
        public bool Run(OpenFileDialogData data)
        {
            var parent = data.TransientFor ?? MessageService.RootWindow;
            CommonFileDialog dialog;

            if (data.Action == FileChooserAction.Open)
            {
                dialog = new CustomCommonOpenFileDialog {
                    EnsureFileExists = true
                };
            }
            else
            {
                dialog = new CustomCommonSaveFileDialog();
            }

            dialog.SetCommonFormProperties(data);

            CustomCommonFileDialogComboBox encodingCombo = null;

            if (data.ShowEncodingSelector)
            {
                var group = new CommonFileDialogGroupBox("encoding", "Encoding:");
                encodingCombo = new CustomCommonFileDialogComboBox();

                BuildEncodingsCombo(encodingCombo, data.Action != FileChooserAction.Save, data.Encoding);
                group.Items.Add(encodingCombo);
                dialog.Controls.Add(group);

                encodingCombo.SelectedIndexChanged += (sender, e) => {
                    if (encodingCombo.SelectedIndex == encodingCombo.Items.Count - 1)
                    {
                        var dlg = new System.Windows.Window {
                            Title         = "Choose encodings",
                            Content       = new SelectEncodingControl(),
                            SizeToContent = SizeToContent.WidthAndHeight
                        };
                        if (dlg.ShowDialog().Value)
                        {
                            BuildEncodingsCombo(encodingCombo, data.Action != FileChooserAction.Save, data.Encoding);
                            dialog.ApplyControlPropertyChange("Items", encodingCombo);
                        }
                    }
                };
            }

            CustomCommonFileDialogComboBox viewerCombo   = null;
            CommonFileDialogCheckBox       closeSolution = null;

            if (data.ShowViewerSelector && data.Action == FileChooserAction.Open)
            {
                var group = new CommonFileDialogGroupBox("openWith", "Open with:");

                viewerCombo = new CustomCommonFileDialogComboBox {
                    Enabled = false
                };
                group.Items.Add(viewerCombo);
                dialog.Controls.Add(group);

                if (encodingCombo != null || IdeApp.Workspace.IsOpen)
                {
                    viewerCombo.SelectedIndexChanged += (o, e) => {
                        bool solutionWorkbenchSelected = ((ViewerComboItem)viewerCombo.Items [viewerCombo.SelectedIndex]).Viewer == null;
                        if (closeSolution != null)
                        {
                            closeSolution.Visible = solutionWorkbenchSelected;
                        }
                        if (encodingCombo != null)
                        {
                            encodingCombo.Enabled = !solutionWorkbenchSelected;
                        }
                    };
                }

                if (IdeApp.Workspace.IsOpen)
                {
                    var group2 = new CommonFileDialogGroupBox();

                    // "Close current workspace" is too long and splits the text on 2 lines.
                    closeSolution = new CommonFileDialogCheckBox("Close workspace", true)
                    {
                        Visible = false
                    };
                    group2.Items.Add(closeSolution);
                    dialog.Controls.Add(group2);
                }

                dialog.SelectionChanged += (sender, e) => {
                    try {
                        var  files    = GetSelectedItems(dialog);
                        var  file     = files.Count == 0 ? null : files[0];
                        bool hasBench = FillViewers(viewerCombo, file);
                        if (closeSolution != null)
                        {
                            closeSolution.Visible = hasBench;
                        }
                        if (encodingCombo != null)
                        {
                            encodingCombo.Enabled = !hasBench;
                        }
                        dialog.ApplyControlPropertyChange("Items", viewerCombo);
                    } catch (Exception ex) {
                        LoggingService.LogInternalError(ex);
                    }
                };
            }

            if (!GdkWin32.RunModalWin32Dialog(dialog, parent))
            {
                return(false);
            }

            dialog.GetCommonFormProperties(data);
            if (encodingCombo != null)
            {
                data.Encoding = ((EncodingComboItem)encodingCombo.Items [encodingCombo.SelectedIndex]).Encoding;
            }

            if (viewerCombo != null)
            {
                if (closeSolution != null)
                {
                    data.CloseCurrentWorkspace = closeSolution.Visible && closeSolution.IsChecked;
                }
                int index = viewerCombo.SelectedIndex;
                if (index != -1)
                {
                    data.SelectedViewer = ((ViewerComboItem)viewerCombo.Items [index]).Viewer;
                }
            }

            return(true);
        }
Example #45
0
    private static bool ShowDialogAndGetResult(this Window window)
    {
        var result = window.ShowDialog();

        return(result.HasValue && result.Value);
    }
Example #46
0
        private void TreeView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (e.Source is RosControl.UI.TreeViewItemSeparator)
            {
                return;
            }
            else if (e.Source is System.Windows.Controls.TreeViewItem)
            {
                switch (Convert.ToString(БыстроеМеню.SelectedValue))
                {
                case "Статистика":
                {
                    var window = new System.Windows.Window()
                    {
                        Title   = "Статистика",
                        Content = new Статистика(),
                        Width   = 800,
                        Height  = 600,
                        WindowStartupLocation = WindowStartupLocation.CenterScreen,
                        ResizeMode            = ResizeMode.NoResize
                    };
                    window.ShowDialog();
                }
                break;

                //case "API":
                //    {
                //        var dialog = new SaveFileDialog()
                //        {
                //            FileName = string.Format("RosService.API.{0}", RosService.Client.Domain),
                //            Filter = "Ros.API (*.dll)|*.dll",
                //            RestoreDirectory = true,
                //            AddExtension = true,
                //            DefaultExt = "dll"
                //        };
                //        if (dialog.ShowDialog().Value)
                //        {
                //            using (RosService.Client client = new RosService.Client())
                //            {
                //                var source = client.Конфигуратор.ПолучитьСборкуApi(client.Пользователь, client.Домен);
                //                File.WriteAllText(dialog.FileName + ".cs", source.ToString());
                //                using (var codeProvider = new Microsoft.CSharp.CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v4.0" } }))
                //                {
                //                    //add compiler parameters
                //                    var compilerParams = new System.CodeDom.Compiler.CompilerParameters();
                //                    compilerParams.CompilerOptions = "/target:library /optimize";
                //                    compilerParams.GenerateExecutable = false;
                //                    compilerParams.GenerateInMemory = false;
                //                    compilerParams.IncludeDebugInformation = false;
                //                    compilerParams.OutputAssembly = dialog.FileName;

                //                    // add some basic references
                //                    compilerParams.ReferencedAssemblies.Add("mscorlib.dll");
                //                    compilerParams.ReferencedAssemblies.Add("System.dll");
                //                    compilerParams.ReferencedAssemblies.Add("System.Data.dll");
                //                    compilerParams.ReferencedAssemblies.Add("System.Xml.dll");
                //                    compilerParams.ReferencedAssemblies.Add(System.Reflection.Assembly.GetAssembly(typeof(RosService.Client)).Location);
                //                    var results = codeProvider.CompileAssemblyFromSource(compilerParams, source.ToString());
                //                    if (results.Errors.Count > 0)
                //                    {
                //                        var errors = new List<string>();
                //                        foreach (System.CodeDom.Compiler.CompilerError error in results.Errors)
                //                            errors.Add(string.Format("Line: {0}; Compile Error: {1}", error.Line, error.ErrorText));
                //                        throw new Exception(String.Join("\n", errors.ToArray()));
                //                    }
                //                }
                //            }
                //            MessageBox.Show(string.Format("Сборка сохранена, имя '{0}'", dialog.FileName));
                //        }
                //    }
                //    break;

                default:
                {
                    if (БыстроеМеню.SelectedItem is RosControl.UI.TreeViewItem)
                    {
                        if (((RosControl.UI.TreeViewItem)БыстроеМеню.SelectedItem).ОткрытьВОкне)
                        {
                            RosControl.Helper.СоздатьОкно(БыстроеМеню.SelectedValue, Хранилище.Конфигурация, 0);
                        }
                        else
                        {
                            var tab = RosControl.Helper.СоздатьВкладку(БыстроеМеню.SelectedValue, Хранилище.Конфигурация, true);
                            if ("ГруппыПользователей".Equals(БыстроеМеню.SelectedValue))
                            {
                                tab.IsFull = true;
                            }
                        }
                    }
                }
                break;
                }
            }
        }
Example #47
0
        /// <summary>
        /// Runs custom wizard logic when a project has finished generating.
        /// </summary>
        /// <param name="project">The project that finished generating.</param>
        public void ProjectFinishedGenerating(Project project)
        {
            //Debug
            Debug.WriteLine("Umbraco New Project - ProjectFinishedGenerating() event");

            try
            {
                //File Path stuff
                _csProjPath   = project.FileName;
                _projectPath  = Path.GetDirectoryName(_csProjPath);
                _solutionPath = Path.GetDirectoryName(_projectPath);
                _packagePath  = Path.Combine(_solutionPath, "packages");


                //Version Picker Dialog (WPF Usercontrol)
                var versionDialog = new VersionPickerDialog();

                //Create a WPF Window
                //Add our WPF UserControl to the window
                Window versionWindow = new Window
                {
                    Title                 = "Create New Umbraco Project Wizard",
                    Content               = versionDialog,
                    SizeToContent         = SizeToContent.WidthAndHeight,
                    ResizeMode            = ResizeMode.NoResize,
                    WindowStartupLocation = WindowStartupLocation.CenterScreen
                                            //Icon                    = new BitmapImage(new Uri("umb-new-blue.ico", UriKind.Relative))
                };

                //Show the window/dialog
                versionWindow.ShowDialog();

                //Get Selected value from dropdown in dialog to use in GetUmbraco()
                var chosenVersion = versionDialog.selectedVersion;

                //Go Get Umbraco from Nuget
                GetUmbraco(project, chosenVersion);


                //Wizard Dialog (WPF Usercontrol)
                var wizard = new WizardDialog();
                wizard.umbracoSitePath      = _destinationFolder;
                wizard.umbracoVersion       = chosenVersion;
                wizard.umbracoVersionNumber = chosenVersion;

                //Create a WPF Window
                //Add our WPF UserControl to the window
                Window myWindow = new Window
                {
                    Title                 = "Create New Umbraco Project Wizard",
                    Content               = wizard,
                    SizeToContent         = SizeToContent.WidthAndHeight,
                    ResizeMode            = ResizeMode.NoResize,
                    WindowStartupLocation = WindowStartupLocation.CenterScreen
                                            //Icon                    = new BitmapImage(new Uri("umb-new-blue.ico", UriKind.Relative))
                };

                //Show the window/dialog
                myWindow.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Debug.WriteLine(ex);
            }
        }