コード例 #1
0
ファイル: EntryPoint.cs プロジェクト: shahjahan0275/acad2fds
        public void ViewResultInSmokeView()
        {
            try
            {
                var fdsConfig = new DefaultFactory(Log).CreateFdsConfig();


                if (fdsConfig == null)
                {
                    UserNotifier.ShowWarning(Constants.PluginWasNotConfigured);
                    return;
                }

                if (string.IsNullOrEmpty(fdsConfig.PathToSmokeView))
                {
                    UserNotifier.ShowWarning(Constants.SmokeViewPathIsnotConfigured);
                    return;
                }

                var openFileDialog = new OpenFileDialog
                {
                    Multiselect = false,
                    Filter      = @"SmokeView files|*.smv",
                };

                var dialogResult = openFileDialog.ShowDialog();

                if (DialogResult.OK != dialogResult)
                {
                    return;
                }

                var smokeViewHandle = CommonHelper.StartSmokeViewProcess(fdsConfig.PathToSmokeView, openFileDialog.FileName);
                var mdiHostHandle   = NativeMethods.GetParent(new DefaultFactory(Log).GetAcadActiveWindow().Handle);

                NativeMethods.SetParent(smokeViewHandle, mdiHostHandle);
                NativeMethods.ShowWindow(smokeViewHandle, NativeMethods.SW_SHOWMAXIMIZED);
            }
            catch (System.Exception exception)
            {
                Log.LogError(exception);
                UserNotifier.ShowError(exception.Message);
            }
        }