Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sources/RevitDBExplorer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Closed="Window_Closed"
Closing="Window_Closing"
KeyDown="Window_KeyDown"
MouseDown="Window_MouseDown"
SizeChanged="Window_SizeChanged"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
TextOptions.TextFormattingMode="Display"
Expand Down
12 changes: 12 additions & 0 deletions sources/RevitDBExplorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,18 @@ private void Window_KeyDown(object sender, KeyEventArgs e)
//Application.RevitWindowHandle.PostKeyMessage(vkey);
}
}
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.XButton2 == MouseButtonState.Pressed)
{
workspacesVM.ActivateNextWorkspace();
}

if (e.XButton1 == MouseButtonState.Pressed)
{
workspacesVM.ActivatePreviousWorkspace();
}
}
private void GlobalKeyboardHook_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyValue == (int)System.Windows.Forms.Keys.F1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ internal class WorkspacesViewModel : BaseViewModel

public event Action<SelectedItemChangedEventArgs> SelectedItemsChanged;
public ObservableCollection<WorkspaceViewModel> Workspaces => workspaces;
public IEnumerable<WorkspaceViewModel> ActiveWorkspaces => workspaces.TakeWhile(o=>o.IsActive);
public WorkspaceViewModel SelectedWorkspace
{
get
Expand Down Expand Up @@ -122,6 +123,24 @@ private void SetSelectedWorkspace(WorkspaceViewModel workspaceViewModel)
OnPropertyChanged(nameof(SelectedWorkspace));
AdjustTabTitleLength();
}
internal void ActivateNextWorkspace()
{
var activeSpaces = ActiveWorkspaces.ToList();
var index = activeSpaces.IndexOf(SelectedWorkspace);
if (activeSpaces.Count() - 1 > index)
{
SetSelectedWorkspace(activeSpaces[index + 1]);
}
}
internal void ActivatePreviousWorkspace()
{
var activeSpaces = ActiveWorkspaces.ToList();
var index = activeSpaces.IndexOf(SelectedWorkspace);
if (0 < index)
{
SetSelectedWorkspace(activeSpaces[index - 1]);
}
}
private WorkspaceViewModel GetFirstAvailableWorkspace()
{
var workspace = Workspaces.Where(x => x.IsActive == false).FirstOrDefault();
Expand Down