| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 | 
							- using H.Pipes;
 
- using InABox.Core;
 
- using InABox.WPF;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Reactive.Subjects;
 
- using System.Runtime.InteropServices;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Data;
 
- using System.Windows.Documents;
 
- using System.Windows.Input;
 
- using System.Windows.Interop;
 
- using System.Windows.Media;
 
- using System.Windows.Media.Imaging;
 
- using System.Windows.Navigation;
 
- using System.Windows.Shapes;
 
- using WampSharp.V2;
 
- using WampSharp.V2.Realm;
 
- namespace PRSRecordingNotes
 
- {
 
-     /// <summary>
 
-     /// Interaction logic for MainWindow.xaml
 
-     /// </summary>
 
-     public partial class ScreenRecorderWindow : Window
 
-     {
 
-         public PipeClient<string> _client { get; private set; }
 
-         //IWampHost _host = null;
 
-         //IWampHostedRealm _realm = null;
 
-         //IWampSubject _subject = null;
 
-         //IDisposable _subscription = null;
 
-         private const int GWL_STYLE = -16;
 
-         private const int WS_SYSMENU = 0x80000;
 
-         [DllImport("user32.dll", SetLastError = true)]
 
-         private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
 
-         [DllImport("user32.dll")]
 
-         private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
 
-         public ScreenRecorderWindow()
 
-         {
 
-             Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(CoreUtils.SyncfusionLicense(SyncfusionVersion.v19_4));
 
-             InitializeComponent();
 
-             HotKeyManager.Initialize();
 
-             HotKeyManager.RegisterHotKey(
 
-                 Key.F6, 
 
-                 () => {
 
-                     ResumeRecording(false);
 
-                     return true;
 
-                 }
 
-             );
 
-             Move.Source = Properties.Resources.target.AsBitmapImage();
 
-             _client = new PipeClient<string>("PRSScreenRecorder",".");
 
-             _client.MessageReceived += (o, args) =>
 
-             {
 
-                 ServerMessage(args.Message);
 
-             };
 
-             _client.ConnectAsync();
 
-             //_host = new WampSharp.V2.DefaultWampHost("ws://127.0.0.1:8001/prs");
 
-             //_host.Open();
 
-             
 
-             //_realm = _host.RealmContainer.GetRealmByName("PRS");
 
-             //_realm.SessionCreated += _realm_SessionCreated;
 
-             //_realm.SessionClosed += _realm_SessionClosed;
 
-             //_subject = _realm.Services.GetSubject("ScreenRecording");
 
-             //_subscription = _subject.Subscribe(
 
-             //    x =>
 
-             //    {
 
-             //        String command = x.Arguments[0].Deserialize<String>();
 
-             //        if (String.Equals(command, "EDIT"))
 
-             //            Dispatcher.Invoke(() => { EditNotes(); });
 
-             //        else if (String.Equals(command, "QUIT"))
 
-             //            Dispatcher.Invoke(() => { System.Windows.Application.Current.Shutdown(); });
 
-             //    }
 
-             //);
 
-             Hide();
 
-         }
 
-         private void ServerMessage(string message)
 
-         {
 
-             if (String.Equals(message, "EDIT"))
 
-                 Dispatcher.Invoke(() => { EditNotes(); });
 
-             else if (String.Equals(message, "QUIT"))
 
-                 Dispatcher.Invoke(() => { System.Windows.Application.Current.Shutdown(); });
 
-         }
 
-         private void _realm_SessionClosed(object sender, WampSessionCloseEventArgs e)
 
-         {
 
-             
 
-         }
 
-         private void _realm_SessionCreated(object sender, WampSessionCreatedEventArgs e)
 
-         {
 
-            
 
-         }
 
-         private void Window_Loaded(object sender, RoutedEventArgs e)
 
-         {
 
-             var hwnd = new WindowInteropHelper(this).Handle;
 
-             SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
 
-         }
 
-         public void EditNotes()
 
-         {
 
-             Buttons.Visibility = Visibility.Visible;
 
-             Show();
 
-         }
 
-         private void Close_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             ResumeRecording(true);
 
-         }
 
-         private void Resume_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             ResumeRecording(false);
 
-         }
 
-         private void ResumeRecording(bool hide)
 
-         {
 
-             if (hide)
 
-                 Hide();
 
-             Buttons.Visibility = Visibility.Collapsed;
 
-             _client.WriteAsync("RESUME");
 
-             //_subject.OnNext(new WampEvent() { Arguments = new[] { "RESUME" } });
 
-         }
 
-         private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-         }
 
-         //bool bMoving = false;
 
-         //Point offset;
 
-         private void Move_MouseDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-             //offset = e.GetPosition(this);
 
-             //bMoving = true;
 
-             this.DragMove();
 
-         }
 
-         private void Move_MouseUp(object sender, MouseButtonEventArgs e)
 
-         {
 
-             //bMoving = false;
 
-         }
 
-         private void Move_MouseMove(object sender, MouseEventArgs e)
 
-         {
 
-             //if (!bMoving)
 
-             //    return;
 
-             //var current = e.GetPosition(this);
 
-             //Left = current.X - offset.X;
 
-             //Top = current.Y - offset.Y;
 
-         }
 
-         /// <summary>Brings main window to foreground.</summary>
 
-         public void BringToForeground()
 
-         {
 
-             //if (this.WindowState == WindowState.Minimized || this.Visibility == Visibility.Hidden)
 
-             //{
 
-             //    this.Show();
 
-             //    this.WindowState = WindowState.Normal;
 
-             //}
 
-             //// According to some sources these steps gurantee that an app will be brought to foreground.
 
-             //this.Activate();
 
-             //this.Topmost = true;
 
-             //this.Topmost = false;
 
-             //this.Focus();
 
-         }
 
-     }
 
- }
 
 
  |