ctrl k
  • DoUrVerse/App.axaml.cs
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  using DoUrVerse.ViewModels;
    5 5  using DoUrVerse.Views;
    6 6  using DoUrVerse.Platform;
     7 +using DoUrVerseLib.Platform;
    7 8  
    8 9  namespace DoUrVerse;
    9 10  
    skipped 10 lines
    20 21   {
    21 22   desktop.MainWindow = new MainWindow
    22 23   {
    23  - DataContext = new MainViewModel(new AvaloniaPlatform())
     24 + DataContext = new MainViewModel(MainWindow.GetPlatform())
    24 25   };
    25 26   }
    26 27   else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
    27 28   {
    28 29   singleViewPlatform.MainView = new MainView
    29 30   {
    30  - DataContext = new MainViewModel(new AvaloniaPlatform())
     31 + DataContext = new MainViewModel(MainWindow.GetPlatform())
    31 32   };
    32 33   }
    33 34  
    skipped 3 lines
  • DoUrVerse/ViewModels/DebugViewModel.cs
    ■ ■ ■ ■ ■ ■
     1 +using System.Reactive;
     2 +using DoUrVerse.Views;
     3 +using DoUrVerseLib.Platform;
     4 +using ReactiveUI;
     5 +namespace DoUrVerse.ViewModels;
     6 + 
     7 +public class DebugViewModel : ViewModelBase
     8 +{
     9 + public ReactiveCommand<Unit, Unit> ListenCommand {get;set;}
     10 + 
     11 + string textlog = "";
     12 + public string TextLog
     13 + {
     14 + get => textlog;
     15 + set => this.RaiseAndSetIfChanged(ref textlog, value, nameof(TextLog));
     16 + }
     17 + bool isListening = false;
     18 + public bool IsListening
     19 + {
     20 + get => isListening;
     21 + set => this.RaiseAndSetIfChanged(ref isListening, value, nameof(IsListening));
     22 + }
     23 + 
     24 + public DebugViewModel(IPlatform platform) : base(platform)
     25 + {
     26 + ListenCommand = ReactiveCommand.Create(listen);
     27 + }
     28 + public DebugViewModel() : base(MainWindow.GetPlatform())
     29 + {
     30 + ListenCommand = ReactiveCommand.Create(listen);
     31 + }
     32 + 
     33 + void listen()
     34 + {
     35 +
     36 + }
     37 +}
  • DoUrVerse/Views/MainWindow.axaml.cs
    ■ ■ ■ ■ ■
    skipped 1 lines
    2 2  using Avalonia.Controls;
    3 3  using Avalonia.Controls.ApplicationLifetimes;
    4 4  using Avalonia.Markup.Xaml;
     5 +using DoUrVerse.Platform;
    5 6  using DoUrVerseLib.Device;
     7 +using DoUrVerseLib.Platform;
    6 8  
    7 9  namespace DoUrVerse.Views;
    8 10  
    9 11  public partial class MainWindow : Window
    10 12  {
     13 +
     14 + static readonly AvaloniaPlatform platform = new AvaloniaPlatform();
    11 15   public MainWindow()
    12 16   {
    13 17  #if DEBUG
    skipped 24 lines
    38 42   }
    39 43   return null;
    40 44   }
     45 + public static AvaloniaPlatform GetPlatform() => platform;
    41 46  }
  • DoUrVerse/Views/ProfilePanel/DebugView.axaml
    ■ ■ ■ ■ ■ ■
     1 +<UserControl xmlns="https://github.com/avaloniaui"
     2 + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     3 + xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     4 + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     5 + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
     6 + x:Class="DoUrVerse.Views.DebugView"
     7 + xmlns:vm="using:DoUrVerse.ViewModels"
     8 + x:DataType="vm:DebugViewModel">
     9 + <Grid>
     10 +
     11 + <Grid.RowDefinitions>
     12 + <RowDefinition Height="auto" />
     13 + <RowDefinition Height="*" />
     14 + </Grid.RowDefinitions>
     15 + <StackPanel Grid.Row="0" Orientation="Horizontal">
     16 + <Label >Get input </Label>
     17 + <ToggleButton IsChecked="{Binding IsListening}" Command="{Binding ListenCommand}">Start listening</ToggleButton>
     18 + </StackPanel>
     19 + <TextBox Grid.Row="1"
     20 + Text="{Binding TextLog}"
     21 + VerticalAlignment="Stretch"
     22 + AcceptsReturn="true"
     23 + TextWrapping="Wrap"
     24 + IsReadOnly="true"
     25 + Watermark="Input strokes from devices will appear here" />
     26 + </Grid>
     27 +</UserControl>
     28 + 
  • DoUrVerse/Views/ProfilePanel/DebugView.axaml.cs
    ■ ■ ■ ■ ■ ■
     1 +using Avalonia;
     2 +using Avalonia.Controls;
     3 +using Avalonia.Markup.Xaml;
     4 +using DoUrVerse.ViewModels;
     5 +
     6 +namespace DoUrVerse.Views;
     7 +
     8 +public partial class DebugView : View<DebugViewModel>
     9 +{
     10 + public DebugView()
     11 + {
     12 + InitializeComponent();
     13 + }
     14 +}
  • DoUrVerse/Views/ProfilePanel/ProfilePanel.axaml
    ■ ■ ■ ■ ■ ■
    skipped 16 lines
    17 17   <TabItem.Header>Profile</TabItem.Header>
    18 18   <views:ProfileSettings DataContext="{Binding ProfileSettings}"></views:ProfileSettings>
    19 19   </TabItem>
     20 + <TabItem>
     21 + <TabItem.Header>Debug</TabItem.Header>
     22 + <vm:DebugViewModel />
     23 + </TabItem>
    20 24   </TabControl>
    21 25   </Grid>
    22 26  </UserControl>
    skipped 1 lines
Please wait...
Page is in error, reload to recover