This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
198 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
namespace AppInfo.Command | ||
using System.Windows; | ||
using System.Windows.Interop; | ||
using AppInfo.View; | ||
using AppInfo.ViewModel; | ||
using Application = System.Windows.Forms.Application; | ||
|
||
namespace AppInfo.Command | ||
{ | ||
public class SnoopSearch : BaseCommand | ||
{ | ||
public override SnoopType SnoopType { get; set; } = SnoopType.Search; | ||
|
||
public override int Execute(params string[] parameters) | ||
{ | ||
AppInfoViewModel viewModel = new AppInfoViewModel(SnoopType); | ||
SearchByContains searchByContains = new SearchByContains(viewModel); | ||
searchByContains.WindowStartupLocation = WindowStartupLocation.CenterScreen; | ||
IntPtr handle = Autodesk.Navisworks.Api.Application.Gui.MainWindow.Handle; | ||
new WindowInteropHelper(searchByContains).Owner = handle; | ||
searchByContains.ShowDialog(); | ||
return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace AppInfo.Model; | ||
|
||
public class NodeSearch | ||
{ | ||
public enum SearchType | ||
{ | ||
ClashResultGuid, | ||
ClashResultName, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,67 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using System.Windows.Interop; | ||
using AppInfo.Model; | ||
using AppInfo.ViewModel; | ||
using Application = Autodesk.Navisworks.Api.Application; | ||
using KeyEventArgs = System.Windows.Input.KeyEventArgs; | ||
using MessageBox = System.Windows.MessageBox; | ||
|
||
namespace AppInfo.View | ||
{ | ||
public partial class SearchByContains : Window | ||
{ | ||
private AppInfoViewModel _viewModel { get; } | ||
private AppInfoViewModel _viewModel { get; set; } | ||
public SearchByContains(AppInfoViewModel viewModel) | ||
{ | ||
InitializeComponent(); | ||
this._viewModel = viewModel; | ||
WindowStartupLocation = WindowStartupLocation.CenterScreen; | ||
_viewModel = viewModel; | ||
this.DataContext = viewModel; | ||
KeyDown += Window_KeyDown; | ||
} | ||
private void Window_KeyDown(object sender, KeyEventArgs e) | ||
{ | ||
if (e.Key == Key.Enter) | ||
{ | ||
SnoopSearchClick(sender, e); | ||
} | ||
} | ||
|
||
|
||
[STAThread] | ||
private void SnoopSearchClick(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
switch (cbbSnoopType.Text) | ||
{ | ||
case "ClashResult Name": | ||
_viewModel.SearchType = NodeSearch.SearchType.ClashResultName; | ||
break; | ||
case "ClashResult Guid": | ||
_viewModel.SearchType = NodeSearch.SearchType.ClashResultGuid; | ||
break; | ||
} | ||
|
||
if (string.IsNullOrEmpty(txtSearchValue.Text)) | ||
{ | ||
MessageBox.Show("Please input search value"); | ||
return; | ||
} | ||
_viewModel.SearchValue = txtSearchValue.Text.ToLower(); | ||
Close(); | ||
FrmAppInfo frmAppInfo = new FrmAppInfo(_viewModel); | ||
frmAppInfo.WindowStartupLocation = WindowStartupLocation.CenterScreen; | ||
IntPtr handle = Application.Gui.MainWindow.Handle; | ||
new WindowInteropHelper(frmAppInfo).Owner = handle; | ||
frmAppInfo.Show(); | ||
} | ||
catch (Exception exception) | ||
{ | ||
MessageBox.Show(exception.Message); | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters