commit 과 push test
This commit is contained in:
165
EG-BIMModeler_Source/MainWindow.xaml
Normal file
165
EG-BIMModeler_Source/MainWindow.xaml
Normal file
@@ -0,0 +1,165 @@
|
||||
<mah:MetroWindow x:Class="EGModeler.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:eg="http://hanmaceng.co.kr/HmEG"
|
||||
xmlns:cb="clr-namespace:Editor.CommandControl;assembly=Editor04.CommandControl"
|
||||
xmlns:local="clr-namespace:EGModeler"
|
||||
xmlns:v="clr-namespace:EditorCore.View;assembly=EditorCore"
|
||||
xmlns:control="clr-namespace:EGModeler.Controls"
|
||||
xmlns:corecontrol="clr-namespace:EditorCore.Controls;assembly=EditorCore"
|
||||
xmlns:commonUI="clr-namespace:HmCommonUI;assembly=HmCommonUI"
|
||||
xmlns:vm="clr-namespace:EGModeler.ViewModels"
|
||||
xmlns:enums="clr-namespace:EditorCore.Enums;assembly=EditorCore"
|
||||
xmlns:localization="clr-namespace:Editor.Localization;assembly=Editor01.Localization"
|
||||
MinWidth="1345" MinHeight="600" d:Width="1920" d:Height="1080" Width="1280" Height="720"
|
||||
mc:Ignorable="d" WindowState="{Binding WindowState}" mah:DialogParticipation.Register="{Binding}"
|
||||
ShowTitleBar="True" ShowMinButton="False" ShowCloseButton="False" ShowMaxRestoreButton="False"
|
||||
Title="EGModeler" Name="root" Background="Transparent" Loaded="MainWindow_Loaded">
|
||||
|
||||
<mah:MetroWindow.TitleTemplate>
|
||||
<DataTemplate>
|
||||
<control:ModelerUpperBar x:Name="titleBar" Loaded="titleBar_Loaded"/>
|
||||
</DataTemplate>
|
||||
</mah:MetroWindow.TitleTemplate>
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<local:BoolToParameterConverter x:Key="BoolToParameterConverter"/>
|
||||
<Style TargetType="commonUI:StrokeText" BasedOn="{StaticResource {x:Type commonUI:StrokeText}}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
|
||||
<Grid x:Name="MainWindowContentGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="3"/>
|
||||
<RowDefinition Height="0" MaxHeight="400"/>
|
||||
<RowDefinition Height="70"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="75"/>
|
||||
<ColumnDefinition Width="315"/>
|
||||
<ColumnDefinition MinWidth="200" Width="*"/>
|
||||
<ColumnDefinition Width="2"/>
|
||||
<ColumnDefinition MinWidth="200" Width="*"/>
|
||||
<ColumnDefinition Width="75"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<localization:DummyControl Language="ko_KR"/>
|
||||
<Grid x:Name="MainViewportGrid" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Grid.ColumnSpan="6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="{Binding IsSidePanelVisible, Converter={StaticResource BoolToParameterConverter}, ConverterParameter=2}" />
|
||||
<ColumnDefinition Width="{Binding IsSidePanelVisible, Converter={StaticResource BoolToParameterConverter}, ConverterParameter=380}" MinWidth="{Binding IsSidePanelVisible, Converter={StaticResource BoolToParameterConverter}, ConverterParameter=380}" MaxWidth="1000"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<control:LeftViewportPanel AllowDrop="True" DragEnter="ViewPortPanel_DragEnter" Drop="ViewPortPanel_Drop" />
|
||||
<corecontrol:PropertySummaryBar VerticalAlignment="Top" HorizontalAlignment="Left" Visibility="Hidden" Margin="330 0 0 0"/>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left">
|
||||
<Border CornerRadius="0 5 5 0" Background="#ECE4D2" BorderBrush="Black" BorderThickness="1" Visibility="{Binding IsLeftSidePanelVisible, Converter={StaticResource boolToVisibilityConverter}}">
|
||||
<StackPanel Width="140">
|
||||
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Bottom" IsEnabled="{Binding IsUsingDefaultSelectFilter}" Margin="0 2">
|
||||
<commonUI:StrokeText Fill="{DynamicResource SolidColorBrushTable.Type4.Normal.Foreground}" FontWeight="SemiBold" Text="{DynamicResource Control@SELECTIONFILTER}" Margin="2 5 2 2"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@POINT}" IsChecked="{Binding Point, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@LINE}" IsChecked="{Binding Curve, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@MESH}" IsChecked="{Binding Mesh, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@DIMENSION}" IsChecked="{Binding Dimension, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@TEXT}" IsChecked="{Binding Text, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@HATCH}" IsEnabled="False"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@BLOCK}" IsChecked="{Binding Block, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@GROUP}" IsEnabled="False"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@BILLBOARD}" IsChecked="{Binding Billboard, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@CONTROL_POINT}" IsChecked="{Binding ControlPoint, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@VERTEX}" IsChecked="{Binding TopologyVertex, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@EDGE}" IsChecked="{Binding TopologyEdge, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@FACE}" IsChecked="{Binding TopologyFace, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@OTHER}" IsChecked="{Binding Other, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Bottom" IsEnabled="{Binding IsOsnap}" Margin="0 2">
|
||||
<commonUI:StrokeText Fill="{DynamicResource SolidColorBrushTable.Type4.Normal.Foreground}" FontWeight="SemiBold" Text="{DynamicResource Control@OSNAP}" Margin="2 5 2 2"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@POINT}" IsChecked="{Binding PointOsnap, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@NEAR_POINT}" IsChecked="{Binding NearOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@END_POINT}" IsChecked="{Binding EndOsnap, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@MID_POINT}" IsChecked="{Binding MidpointOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@QUADRANT_POINT}" IsChecked="{Binding QuadrantOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@CENTER_POINT}" IsChecked="{Binding CenterOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@TANGENT_POINT}" IsChecked="{Binding TangentOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@VERTEX}" IsChecked="{Binding VertexOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@PERPENDICULAR_POINT}" IsChecked="{Binding PerpendicularOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@EXTENSION}" IsEnabled="False"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@INTERSECTION}" IsChecked="{Binding IntersectionOsnap, Mode=TwoWay}"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@KNOT_POINT}" IsChecked="{Binding KnotOsnap, Mode=TwoWay}" IsEnabled="False"/>
|
||||
<commonUI:HmCheckBox Margin="2 3" Content="{DynamicResource Control@PROJECTION_POINT}" IsChecked="{Binding ProjectionOsnap, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<corecontrol:FlipToggleButton HorizontalAlignment="Left" VerticalAlignment="Bottom" IsChecked="{Binding IsLeftSidePanelVisible, Mode=TwoWay}" IsLeftFlip="True" Margin="-1 0 0 10"/>
|
||||
</StackPanel>
|
||||
<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="15 5 0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="330"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Visibility="{Binding CursorCoordinateDisplay, Converter={StaticResource boolToVisibilityConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<commonUI:StrokeText Grid.Column="0" Text="{Binding MousePosX}" Fill="White" StrokeThickness="2" FontSize="13" FontWeight="Bold" VerticalAlignment="Bottom"/>
|
||||
<commonUI:StrokeText Grid.Column="1" Text="{Binding MousePosY}" Fill="White" StrokeThickness="2" FontSize="13" FontWeight="Bold" VerticalAlignment="Bottom"/>
|
||||
<commonUI:StrokeText Grid.Column="2" Text="{Binding MousePosZ}" Fill="White" StrokeThickness="2" FontSize="13" FontWeight="Bold" VerticalAlignment="Bottom"/>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="3" Margin="0 0 10 0">
|
||||
<commonUI:StrokeText Text="{Binding ShowCoordOpt}" Fill="White" StrokeThickness="2" FontSize="13" FontWeight="Bold" Visibility="{Binding CursorCoordinateDisplay, Converter={StaticResource boolToVisibilityConverter}}"/>
|
||||
<commonUI:StrokeText Text="{Binding CurrentUnitStr}" Fill="White" StrokeThickness="2" FontSize="13" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<corecontrol:FlipToggleButton HorizontalAlignment="Right" IsChecked="{Binding IsSidePanelVisible, Mode=TwoWay}" Margin="0 0 -1 0"/>
|
||||
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" Focusable="False"/>
|
||||
<v:SidePanel Grid.Column="2" Visibility="{Binding IsSidePanelVisible, Converter={StaticResource boolToVisibilityConverter}}"/>
|
||||
</Grid>
|
||||
|
||||
<GridSplitter Grid.Row="1" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" Focusable="False" MouseDoubleClick="GridSplitter_MouseDoubleClick"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right" Style="{DynamicResource LowerExpandButtonButtonStyle}" IsDefault="True" Content="{DynamicResource Control@SETTINGS}" Command="{Binding SeeAllCommands}" CommandParameter="{x:Static enums:AllCommandsWindowCategory.Settings}"/>
|
||||
|
||||
<Grid Grid.Row="3" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<commonUI:HmFooterToggleButton Grid.Row="0" Grid.Column="0" Focusable="False" Content="{DynamicResource Control@OSNAP}" IsChecked="{Binding IsOsnap}" Kind="Object_Snap" />
|
||||
<commonUI:HmFooterToggleButton Grid.Row="0" Grid.Column="1" Focusable="False" Content="{DynamicResource Control@GRIDSNAP}" IsChecked="{Binding GridSnap}" Kind="Grid_Snap" />
|
||||
<commonUI:HmFooterToggleButton Grid.Row="0" Grid.Column="2" Focusable="False" Content="{DynamicResource Control@SNAP_TRACE}" IsChecked="{Binding SnapTrace}" Kind="Custom" PathData="{DynamicResource Object_Trace_DrawingImage}"/>
|
||||
<commonUI:HmFooterToggleButton Grid.Row="1" Grid.Column="0" Focusable="False" Content="{DynamicResource Control@ORTHOMODE}" IsChecked="{Binding OrthoMode}" Kind="Orthogonal" />
|
||||
<commonUI:HmFooterToggleButton Grid.Row="1" Grid.Column="1" Focusable="False" Content="{DynamicResource Control@PLANARMODE}" IsChecked="{Binding PlanarMode}" Kind="Orthogonal" />
|
||||
<commonUI:HmFooterToggleButton Grid.Row="1" Grid.Column="2" Focusable="False" Content="{DynamicResource Control@SELECTIONFILTER}" IsChecked="{Binding IsUsingDefaultSelectFilter}" Kind="Visual_Effect" />
|
||||
</Grid>
|
||||
|
||||
<cb:CommandPanel Grid.Row="2" Grid.Column="2" Grid.RowSpan="2" SizeChanged="CommandPanel_SizeChanged" InstanceIdx="0"/>
|
||||
|
||||
<GridSplitter Grid.Row="3" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" Focusable="False"/>
|
||||
|
||||
<control:CommandTabPanel Grid.Row="3" Grid.Column="4"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="5" HorizontalAlignment="Right" Style="{DynamicResource LowerExpandButtonButtonStyle}" IsDefault="True" Content="{DynamicResource Control@SEEALLCOMMANDS}" Command="{Binding SeeAllCommands}" CommandParameter="{x:Static enums:AllCommandsWindowCategory.Create}"/>
|
||||
|
||||
<Grid x:Name="WidzetCanvas" Grid.ColumnSpan="100" Grid.RowSpan="100"/>
|
||||
|
||||
<Grid x:Name="settingOptionPanel" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="4" Grid.ColumnSpan="2" Height="100" Width="408"/>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
441
EG-BIMModeler_Source/MainWindow.xaml.cs
Normal file
441
EG-BIMModeler_Source/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,441 @@
|
||||
using Editor.AppManager;
|
||||
using Editor.CommandControl.ViewModel;
|
||||
using Editor.CommandCore;
|
||||
using Editor.CommandCustom;
|
||||
using Editor.PluginInterface;
|
||||
using Editor.WidzetPluginInterface;
|
||||
using EditorCore;
|
||||
using EGModeler.Controls;
|
||||
using EGModeler.ViewModels;
|
||||
using HmEG;
|
||||
using HmEG.Controls;
|
||||
using MahApps.Metro.Controls;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
|
||||
|
||||
namespace EGModeler
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : MetroWindow
|
||||
{
|
||||
private ECommandManager ECommandManager { get => ECommandManager.GetCommandManager(0); }
|
||||
private SnapAssist? _snap;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
//테마 테스트
|
||||
//ThemeManager.Instance.SwitchTheme(ThemeType.ColorThemeBlack);
|
||||
InitializeComponent();
|
||||
MainWindowLoadingHelper.Instance.IsInitialized = true;
|
||||
this.DataContext = MainWindowViewModel.Instance;
|
||||
WidzetPlugin.AttachWidzet();
|
||||
HmEGAppManager.GetAppManager(0).SettingManager.PropertyChanged += PropertyChanged;
|
||||
//#if !DEBUG //모델러 모드 강제 (배포 전 작업, 주석 해제 후 사용)
|
||||
// HmEGAppManager.GetAppManager(0).SettingManager.ModelerMode = ModelerMode.ModelingNViewing;
|
||||
//#endif
|
||||
_snap = new SnapAssist(this);
|
||||
_snap.Attach();
|
||||
}
|
||||
|
||||
private void PropertyChanged(object? sender, System.Reflection.PropertyInfo e)
|
||||
{
|
||||
if(e.Name.Equals("IsSidePanelVisible"))
|
||||
{
|
||||
var MainViewportGrid = this.FindChild<Grid>("MainViewportGrid");
|
||||
var isShow = HmEGAppManager.GetAppManager(0).SettingManager.IsSidePanelVisible;
|
||||
if(isShow)
|
||||
{
|
||||
MainViewportGrid.ColumnDefinitions[1].Width = new GridLength(2);
|
||||
MainViewportGrid.ColumnDefinitions[2].Width = new GridLength(MainViewportGrid.ColumnDefinitions[2].Width.Value, GridUnitType.Auto);
|
||||
MainViewportGrid.ColumnDefinitions[2].MinWidth = 370;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainViewportGrid.ColumnDefinitions[1].Width = new GridLength(0);
|
||||
MainViewportGrid.ColumnDefinitions[2].Width = new GridLength(0);
|
||||
MainViewportGrid.ColumnDefinitions[2].MinWidth = 0;
|
||||
}
|
||||
}
|
||||
//#if !DEBUG //모델러 모드 강제 (배포 전 작업, 주석 해제 후 사용)
|
||||
// if (e.Name.Equals("ModelerMode"))
|
||||
// {
|
||||
// var mode = HmEGAppManager.GetAppManager(0).SettingManager.ModelerMode;
|
||||
// if (mode != ModelerMode.ModelingNViewing)
|
||||
// {
|
||||
// HmEGAppManager.GetAppManager(0).SettingManager.ModelerMode = ModelerMode.ModelingNViewing;
|
||||
// HmEGAppManager.GetAppManager(0).UpdateSettingJson();
|
||||
// }
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
|
||||
private void titleBar_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if(sender != null)
|
||||
{
|
||||
this.TitleBarHeight = (int)((System.Windows.Controls.UserControl)sender).ActualHeight;
|
||||
}
|
||||
}
|
||||
|
||||
GridLength tmpHeight;
|
||||
|
||||
GradientTransparencySettingPanel gradientTransparencySettingPanel = new GradientTransparencySettingPanel();
|
||||
private AdornerLayer _adornerLayer;
|
||||
private CustomAdorner _adorner;
|
||||
|
||||
private void MainWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
_adornerLayer = AdornerLayer.GetAdornerLayer(settingOptionPanel);
|
||||
|
||||
if (_adorner != null)
|
||||
{
|
||||
_adornerLayer.Remove(_adorner);
|
||||
_adorner = null;
|
||||
return;
|
||||
}
|
||||
|
||||
ScrollContentPresenter scrollPresenter = new ScrollContentPresenter
|
||||
{
|
||||
Content = gradientTransparencySettingPanel
|
||||
};
|
||||
|
||||
_adorner = new CustomAdorner(settingOptionPanel, scrollPresenter);
|
||||
_adornerLayer.Add(_adorner);
|
||||
|
||||
var MainWindowContentGrid = this.FindChild<Grid>("MainWindowContentGrid");
|
||||
if (MainWindowContentGrid != null)
|
||||
{
|
||||
MainWindowContentGrid.RowDefinitions[2].Height = new GridLength(HmEGAppManager.GetAppManager(0).SettingManager.MainCommandPanelHeight);
|
||||
tmpHeight = MainWindowContentGrid.RowDefinitions[2].Height;
|
||||
}
|
||||
|
||||
var screens = System.Windows.Forms.Screen.AllScreens;
|
||||
|
||||
//뷰포트가 전부 로드되면 로딩창 닫는다.
|
||||
var viewports = this.FindChildren<EGViewport>();
|
||||
foreach(var viewport in viewports)
|
||||
{
|
||||
viewCount++;
|
||||
viewport.OnRendered += Viewport_OnRendered;
|
||||
}
|
||||
|
||||
if (HmEGAppManager.GetAppManager(0).SettingManager.IsSecondWindowOn)
|
||||
{
|
||||
var secondWindow = new SecondWindow();
|
||||
var primaryScreen = screens.FirstOrDefault(s => s.Primary);
|
||||
|
||||
if (primaryScreen != null)
|
||||
{
|
||||
var secondaryScreen = screens
|
||||
.Where(s => s.Bounds.X > primaryScreen.Bounds.X)
|
||||
.OrderBy(s => s.Bounds.X)
|
||||
.FirstOrDefault();
|
||||
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
var dpi = GetDpiForScreen();
|
||||
if (secondaryScreen != null)
|
||||
{
|
||||
secondWindow.Left = (secondaryScreen.WorkingArea.Left) / dpi;
|
||||
secondWindow.Top = (secondaryScreen.WorkingArea.Top) / dpi;
|
||||
}
|
||||
else
|
||||
{
|
||||
secondWindow.Left = (primaryScreen.WorkingArea.Left) / dpi;
|
||||
secondWindow.Top = (primaryScreen.WorkingArea.Top) / dpi;
|
||||
}
|
||||
secondWindow.Show();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
secondWindow.Show();
|
||||
}
|
||||
|
||||
var viewports2 = secondWindow.FindChildren<EGViewport>();
|
||||
if (HmEGAppManager.GetAppManager(0).SettingManager.IsSecondWindowOn)
|
||||
{
|
||||
//세컨드윈도우 활성화를위한
|
||||
foreach (var viewport in viewports2)
|
||||
{
|
||||
viewCount2++;
|
||||
viewport.OnRendered += Viewport_OnRendered2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var viewport in viewports2)
|
||||
{
|
||||
HmEGAppManager.GetAppManager(0).UnRegisterViewport(viewport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalViewCount = viewCount + viewCount2;
|
||||
MainWindowLoadingHelper.Instance.IsLoaded = true;
|
||||
Application.Current.MainWindow = this;
|
||||
IsSetLayout = true;
|
||||
CommandPanelViewModel.IncludedControls.Add(this);
|
||||
}
|
||||
|
||||
private int totalViewCount = 0;
|
||||
//로드안된 뷰포트 수
|
||||
private int viewCount = 0;
|
||||
private async void Viewport_OnRendered(object? sender, EventArgs e)
|
||||
{
|
||||
var host = (DX11ImageSourceRenderHost)sender;
|
||||
((EGViewport)host.Viewport).OnRendered -= Viewport_OnRendered;
|
||||
viewCount--;
|
||||
totalViewCount--;
|
||||
if (totalViewCount == 0)
|
||||
{
|
||||
if (App.LoadingWindow != null)
|
||||
{
|
||||
if (App.LoadingWindow.Dispatcher.CheckAccess())
|
||||
App.LoadingWindow.Close();
|
||||
else
|
||||
App.LoadingWindow.Dispatcher.Invoke(() => App.LoadingWindow.Close());
|
||||
}
|
||||
ResourceManager.Instance.GetMaterialImages();
|
||||
}
|
||||
if (viewCount == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
await PluginLoader.LoadProjectPluginsAsync();
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
|
||||
//모든 뷰포트가 로드되면 로딩창 닫기전에 메인창 활성화 - 안하면 뒤로간다
|
||||
this.Activate();
|
||||
HmEGAppManager.GetAppManager(0).StartupCommandManager.ExecuteStartCommands();
|
||||
HmEG_DebugWidzetPlugin.AttachDebugTabs();
|
||||
Conference_DebugWidzetPlugin.AttachDebugTabs();
|
||||
}
|
||||
}
|
||||
|
||||
//로드안된 두번째 윈도우 뷰포트 수
|
||||
private int viewCount2 = 0;
|
||||
private void Viewport_OnRendered2(object? sender, EventArgs e)
|
||||
{
|
||||
var host = (DX11ImageSourceRenderHost)sender;
|
||||
((EGViewport)host.Viewport).OnRendered -= Viewport_OnRendered2;
|
||||
viewCount2--;
|
||||
totalViewCount--;
|
||||
//뷰포트가 로드되면 활성화
|
||||
if (viewCount2 == 0)
|
||||
{
|
||||
Window.GetWindow((EGViewport)host.Viewport).Activate();
|
||||
}
|
||||
if (totalViewCount == 0)
|
||||
{
|
||||
App.LoadingWindow.Dispatcher.Invoke(() =>
|
||||
{
|
||||
App.LoadingWindow.Close();
|
||||
//App.LoadingWindow.Dispatcher.InvokeShutdown();
|
||||
});
|
||||
ResourceManager.Instance.GetMaterialImages();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private double GetDpiForScreen()
|
||||
{
|
||||
var source = PresentationSource.FromVisual(this);
|
||||
var matrix = source.CompositionTarget.TransformToDevice;
|
||||
|
||||
double dpi = matrix.M11 * 96.0;
|
||||
|
||||
return dpi / 96.0;
|
||||
}
|
||||
|
||||
private void ViewPortPanel_DragEnter(object sender, System.Windows.DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
e.Effects = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effects = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> targetFiles;
|
||||
|
||||
readonly Dictionary<string, string> extensions = new Dictionary<string, string>()
|
||||
{
|
||||
{ "HANMAC Engineering Format", ".hmeg" },
|
||||
{ "AutoCAD Drawing", ".dwg" },
|
||||
{ "AutoCAD Drawing Exchange", ".dxf" },
|
||||
{ "GRIMI Drawing File", ".grm" },
|
||||
{ "Wavefront Object Format", ".obj" },
|
||||
//{ "Rhino 3D Model", ".3dm" },
|
||||
{ "WPB File", ".wpb" },
|
||||
{ "WPB_IFC File", ".wpb_ifc" },
|
||||
{ "Industry Foundation Classes", ".ifc" },
|
||||
{ "Triangulated Irregular Network", ".tins" },
|
||||
{ "3D Studio", ".3ds" },
|
||||
{ "Collada File", ".dae" },
|
||||
{ "MotionBuilder", ".fbx" },
|
||||
{ "glTF Binary File", ".glb" },
|
||||
{ "glTF Text File", ".gltf" },
|
||||
{ "XML File", ".xml" },
|
||||
};
|
||||
|
||||
private void ViewPortPanel_Drop(object sender, System.Windows.DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
||||
var allowedExtensions = extensions.Values.Select(ext => ext.ToLower()).ToList();
|
||||
|
||||
var validFiles = files.Where(file =>
|
||||
{
|
||||
string extension = System.IO.Path.GetExtension(file).ToLower();
|
||||
return allowedExtensions.Contains(extension);
|
||||
}).ToArray();
|
||||
|
||||
if (validFiles.Length > 1)
|
||||
{
|
||||
if (!LoadingWindowHelperThread.Instance.IsOpen)
|
||||
LoadingWindowHelperThread.Instance.Open();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("! ImportByPath ");
|
||||
for (int i = 0; i < files.Count(); i++)
|
||||
{
|
||||
sb.Append("\"" + files[i] + "\"");
|
||||
if (i != files.Count() - 1)
|
||||
sb.Append("\u001F,");
|
||||
}
|
||||
ECommandManager.ExcuteCommand(sb.ToString());
|
||||
}
|
||||
else if(validFiles.Length == 1)
|
||||
{
|
||||
string file = validFiles[0];
|
||||
var owner = Application.Current.Windows.OfType<MainWindow>().FirstOrDefault();
|
||||
MessageBoxResult result;
|
||||
if (owner != null)
|
||||
{
|
||||
result = MessageBox.Show(
|
||||
owner,
|
||||
"파일을 Import 하시겠습니까?\n'아니오'를 선택하면 Open됩니다.",
|
||||
"파일 처리 옵션",
|
||||
MessageBoxButton.YesNoCancel,
|
||||
MessageBoxImage.Question
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = MessageBox.Show(
|
||||
"파일을 Import 하시겠습니까?\n'아니오'를 선택하면 Open됩니다.",
|
||||
"파일 처리 옵션",
|
||||
MessageBoxButton.YesNoCancel,
|
||||
MessageBoxImage.Question
|
||||
);
|
||||
}
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
if (!LoadingWindowHelperThread.Instance.IsOpen)
|
||||
LoadingWindowHelperThread.Instance.Open();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("! ImportByPath ");
|
||||
foreach (var vfile in validFiles)
|
||||
{
|
||||
sb.Append("\"" + vfile + "\"");
|
||||
}
|
||||
ECommandManager.ExcuteCommand(sb.ToString());
|
||||
}
|
||||
else if (result == MessageBoxResult.No)
|
||||
{
|
||||
HmEGAppManager.GetAppManager(0).FileManager.Open(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSetLayout;
|
||||
private void CommandPanel_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
var MainWindowContentGrid = this.FindChild<Grid>("MainWindowContentGrid");
|
||||
if (MainWindowContentGrid != null & IsSetLayout)
|
||||
{
|
||||
HmEGAppManager.GetAppManager(0).SettingManager.MainCommandPanelHeight = MainWindowContentGrid.RowDefinitions[2].Height.Value;
|
||||
tmpHeight = MainWindowContentGrid.RowDefinitions[2].Height.Value < 100 ? tmpHeight : MainWindowContentGrid.RowDefinitions[2].Height;
|
||||
HmEGAppManager.GetAppManager(0).UpdateSettingJson();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void GridSplitter_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var MainWindowContentGrid = this.FindChild<Grid>("MainWindowContentGrid");
|
||||
if (MainWindowContentGrid != null)
|
||||
{
|
||||
if(MainWindowContentGrid.RowDefinitions[2].Height.Value == 0)
|
||||
{
|
||||
MainWindowContentGrid.RowDefinitions[2].Height = tmpHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowContentGrid.RowDefinitions[2].Height = new GridLength(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BoolToParameterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool boolValue)
|
||||
{
|
||||
if (boolValue)
|
||||
{
|
||||
if (parameter != null)
|
||||
{
|
||||
return ConvertParameter(parameter, targetType);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException("ConvertBack is not implemented.");
|
||||
}
|
||||
|
||||
private object ConvertParameter(object parameter, Type targetType)
|
||||
{
|
||||
if (parameter is string paramString)
|
||||
{
|
||||
if (targetType == typeof(double))
|
||||
return double.TryParse(paramString, out double result) ? result : 0;
|
||||
if (targetType == typeof(int))
|
||||
return int.TryParse(paramString, out int result) ? result : 0;
|
||||
if (targetType == typeof(GridLength))
|
||||
return double.TryParse(paramString, out double result) ? new GridLength(result) : new GridLength(0);
|
||||
}
|
||||
return parameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user