예제 #1
0
 private void FModel_MI_Assets_Search_Click(object sender, RoutedEventArgs e)
 {
     DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Window]", "Opening Searcher");
     if (!FWindows.IsWindowOpen <Window>(Properties.Resources.Search))
     {
         new Search().Show();
     }
     else
     {
         Window openedWindow = FWindows.GetOpenedWindow <Window>(Properties.Resources.Search);
         if (openedWindow.WindowState == WindowState.Minimized)
         {
             openedWindow.WindowState = WindowState.Normal;
         }
         else
         {
             openedWindow.Focus();
         }
     }
 }
예제 #2
0
        private void OnOpenImageBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Preview_Img.Source != null)
            {
                if (!FWindows.IsWindowOpen <Window>(Properties.Resources.Preview))
                {
                    Window win = new Window
                    {
                        Title = Properties.Resources.Preview,
                        WindowStartupLocation = WindowStartupLocation.CenterScreen,
                        Width  = Preview_Img.Source.Width,
                        Height = Preview_Img.Source.Height
                    };
                    win.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
                    if (Preview_Img.Source.Height > 1000 || Preview_Img.Source.Width > 1800)
                    {
                        win.WindowState = WindowState.Maximized;
                    }

                    DockPanel dockPanel = new DockPanel
                    {
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment   = VerticalAlignment.Center,
                    };

                    Image img = new Image
                    {
                        UseLayoutRounding = true,
                        Source            = Preview_Img.Source
                    };
                    dockPanel.Children.Add(img);

                    win.Content = dockPanel;
                    win.Show();
                }
                else
                {
                    FWindows.GetOpenedWindow <Window>(Properties.Resources.Preview).Focus();
                }
            }
        }