public MainWindow() { InitializeComponent(); _razer = Provider.Razer; ActivateApp(); Provider.CurrentWindow = this; DataContext = new MainWindowMessageViewModel { Message = "Unknown initialization error", MessageDetails = "Unknown error." }; // Try to init Steam try { var steam = Provider.Steam; if (steam.LocalUser == null) return; Application.Current.MainWindow = new FriendsWindow(); Close(); Application.Current.MainWindow.Show(); } catch (SteamException ex) { var context = new MainWindowMessageViewModel { Message = "Steam failed to initialize properly, is Steam running?", MessageDetails = String.Format("Please close app and launch it after Steam has been started.\n\nError detail:\n{0}: {1}", ex.GetType(), ex.Message) }; DataContext = context; } }
public GamesWindow() { InitializeComponent(); _overlayHelper = new OverlayHelper(NewMessageOverlay, NewMessageOverlayLabel); Provider.Steam.MessageReceived += SteamOnMessageReceived; _razer = Provider.Razer; ActivateApp(); Provider.CurrentWindow = this; }
public MainWindow() { //Init XAML InitializeComponent(); //Create note list _razer = Provider.Razer; _notes = new Dictionary<Rectangle,Pitch>(); _notes.Add(NoteCS,Pitch.CSharp4); _notes.Add(NoteDS,Pitch.DSharp4); _notes.Add(NoteFS,Pitch.FSharp4); _notes.Add(NoteGS,Pitch.GSharp4); _notes.Add(NoteAS,Pitch.ASharp4); _notes.Add(NoteC,Pitch.C4); _notes.Add(NoteD,Pitch.D4); _notes.Add(NoteE,Pitch.E4); _notes.Add(NoteF,Pitch.F4); _notes.Add(NoteG,Pitch.G4); _notes.Add(NoteA,Pitch.A4); _notes.Add(NoteB,Pitch.B4); //sound device if (OutputDevice.InstalledDevices.Count > 0) { _outputDevice = OutputDevice.InstalledDevices[0]; _outputDevice.Open(); _outputDevice.SendProgramChange(Channel.Channel1, Instrument.AcousticGrandPiano); } else Application.Current.Shutdown(); _overlayHelper = new OverlayHelper(NewMessageOverlay, NewMessageOverlayLabel); /* This sends the current window to the SBUI * We give it the Polling RenderMethod which updates * SBUI every 42ms (about 24FPS) */ _razer.Touchpad.SetWindow(this, Touchpad.RenderMethod.Polling); _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK1, OnPressPiano, @"Default\Images\Piano.png"); _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK2, OnPressGuitar, @"Default\Images\Guitar.png"); _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK3, OnPressEPiano, @"Default\Images\EPiano.png"); _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK4, OnPressXylophone, @"Default\Images\Xylo.png"); _razer.EnableDynamicKey(RazerAPI.DynamicKeyType.DK5, OnPressSteelDrums, @"Default\Images\Drums.png"); _razer.Touchpad.Gesture += TouchpadOnGesture; //_razer.Touchpad.EnableGesture(RazerAPI.GestureType.Press); _razer.Touchpad.EnableGesture(RazerAPI.GestureType.Move); _razer.Touchpad.EnableGesture(RazerAPI.GestureType.Tap); //_overlayHelper.Show("Ready to touch"); }
public MainWindow() { InitializeComponent(); try { _manager = RazerManager.Instance; _manager.AppEvent += OnAppEvent; createiTunes(true); setPlayPauseButton(); RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK6, dkBack, @"Default\Images\back.png", @"Default\Images\back_pressed.png", true); RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK8, dkNext, @"Default\Images\forward.png", @"Default\Images\forward_pressed.png", true); RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK9, dkStop, @"Default\Images\stop.png", @"Default\Images\stop_pressed.png", true); RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK1, dkiTunes, @"Default\Images\iTunes.png", @"Default\Images\iTunes.png", true); updateVolumeLabel(); RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK5, dkQuieter, @"Default\Images\quiet.png", @"Default\Images\quiet_pressed.png", true); RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK10, dkLouder, @"Default\Images\louder.png", @"Default\Images\louder_pressed.png", true); //RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK4, dkQuieter, @"Default\Images\quiet.png", @"Default\Images\quiet_pressed.png", true); //RazerManager.Instance.EnableDynamicKey(RazerAPI.DynamicKeyType.DK5, dkLouder, @"Default\Images\louder.png", @"Default\Images\louder_pressed.png", true); //setMuteButton(true); setup(); displayTrack(); _manager.Touchpad.SetWindow(this, Touchpad.RenderMethod.Polling); } catch (Exception ex) { MessageBox.Show("Exception: " + ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error); releaseiTunes(); closeApp(); } }
public ChatWindow(Friend friend) { InitializeComponent(); _friend = friend; _overlayHelper = new OverlayHelper(NewMessageOverlay, NewMessageOverlayLabel); TitleLabel.Content = String.Format(TitleFormat, _friend.Name); _friend.TypingMessageReceived += FriendOnTypingMessageReceived; _friend.ChatMessageReceived += FriendOnChatMessageReceived; Provider.Steam.MessageReceived += SteamOnMessageReceived; var viewModel = FriendViewModel.GetViewModel(_friend); DataContext = viewModel; ((INotifyCollectionChanged) viewModel.Messages.Messages).CollectionChanged += MessagesCollectionChanged; _razer = Provider.Razer; ActivateApp(); Provider.CurrentWindow = this; }