public AboutPage() { InitializeComponent(); AboutNebula.Text = string.Format(NebulaClient.GetLocString("AboutNebula"), Assembly.GetExecutingAssembly().GetName().Version); }
private void OnPlaylistElementMouseDown(object sender, MouseButtonEventArgs e) { if (sender is Grid grid && grid.DataContext is IPlaylist playlist) { NebulaClient.Navigate(typeof(PlaylistPage), playlist, new DrillInNavigationTransitionInfo()); } }
private void SetSession(SharedSessionInfo sessionInfo, UserInfo[] users = null) { if (!NebulaClient.Network.IsConnected || sessionInfo == SharedSessionInfo.Empty) { IsSessionActive = false; return; } Id = sessionInfo.Id; Name = sessionInfo.Name; MaxUsers = sessionInfo.MaximumUsers; PasswordProtected = sessionInfo.PasswordProtected; Users.Clear(); Messages.Clear(); if (users != null && users.Length > 0) { foreach (UserInfo user in users) { Users.Add(user); } } IsSessionActive = true; NebulaClient.Navigate(typeof(SharedSessionPage), null, new DrillInNavigationTransitionInfo()); }
private void OnClientContextMenuOpen(object sender, ContextMenuEventArgs e) { NebulaClient hClient = m_hClientList.SelectedItem as NebulaClient; object first = m_hClientContextMenu.Items[0]; object second = m_hClientContextMenu.Items[1]; object third = m_hClientContextMenu.Items[2]; object fourth = m_hClientContextMenu.Items[3]; m_hClientContextMenu.Items.Clear(); m_hClientContextMenu.Items.Add(first); m_hClientContextMenu.Items.Add(second); m_hClientContextMenu.Items.Add(third); m_hClientContextMenu.Items.Add(fourth); foreach (var item in hClient.Modules) { MenuItem hMenuItem = new MenuItem(); hMenuItem.Header = item.Name; m_hClientContextMenu.Items.Add(hMenuItem); foreach (var method in item.Methods) { MenuItem hMethodItem = new MenuItem(); hMethodItem.Header = method.MethodName; hMethodItem.Tag = item; hMethodItem.Click += HMenuItem_Click1; hMenuItem.Items.Add(hMethodItem); } } }
public void HandleControl(FrameworkElement element, PropertyInfo propertyInfo, DataCategory dataCategory, DataProperty dataProperty, ref DependencyProperty dependencyProperty) { FrameworkElement bindableElement = element is IDataControlsContainer container?container.GetBindableElement() : element; bindableElement.Tag = dataProperty.Tag; if (!string.IsNullOrWhiteSpace(dataProperty.ToolTipKey)) { bindableElement.ToolTip = NebulaClient.GetLocString(dataProperty.ToolTipKey); } if (bindableElement is Control control) { ControlHelper.SetHeader(control, NebulaClient.GetLocString(dataProperty.HeaderKey)); ControlHelper.SetPlaceholderText(control, NebulaClient.GetLocString(dataProperty.PlaceholderKey)); ControlHelper.SetDescription(control, NebulaClient.GetLocString(dataProperty.DescriptionKey)); } if (string.IsNullOrWhiteSpace(dataProperty.DependencyProperty)) { return; } dependencyProperty = bindableElement.GetType().GetField(dataProperty.DependencyProperty, FieldBindingFlags)?.GetValue(bindableElement) as DependencyProperty; }
private async void OnCheckForUpdateClick(object sender, RoutedEventArgs e) { CheckForUpdateButton.IsEnabled = false; await NebulaClient.CheckForUpdate(false); CheckForUpdateButton.IsEnabled = true; }
public ReplModuleWindow(NebulaClient hClient, Guid vModule) { m_hClient = hClient; m_vId = vModule; m_hSb = new StringBuilder(); InitializeComponent(); }
private void OnReceiveSessionUserMessagePacket(SharedSessionUserMessagePacket packet, NebulaNetClient net) { if (!IsSessionActive) { return; } NebulaClient.BeginInvoke(() => AddMessage(new SharedSessionMessage(FindUserById(packet.User.Id), packet.Message))); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); Medias = NebulaClient.MediaPlayer.MediaQueue.GetPages(); Medias.PageChanged += OnPageChanged; Username.Text = NebulaClient.GetLocString("HomeWelcome", NebulaClient.Settings.UserProfile.Username); TitlesDuration.Text = Medias.Collection.Count > 0 ? $"{NebulaClient.GetLocString("PlaylistTitles", Medias.Collection.Count)}" : ""; PagesCount.Text = Medias.TotalPages != 0 ? $"{Medias.CurrentPage + 1}/{Medias.TotalPages}" : "1/1"; }
private void HMenuItem_Click1(object sender, RoutedEventArgs e) { NebulaClient hClient = m_hClientList.SelectedItem as NebulaClient; MenuItem item = sender as MenuItem; NebulaModuleInfo hModuleInfo = item.Tag as NebulaModuleInfo; m_hOutputWindow = new ReplModuleWindow(hClient, hModuleInfo.Guid); m_hOutputWindow.Show(); }
public void HandleControl(FrameworkElement element, PropertyInfo propertyInfo, DataCategory dataCategory, DataProperty dataProperty, ref DependencyProperty dependencyProperty) { dependencyProperty = ToggleButton.IsCheckedProperty; if (element is CheckBox checkBox) { checkBox.Content = NebulaClient.GetLocString(dataProperty.HeaderKey); } }
public void Leave() { if (!IsSessionActive) { return; } NebulaClient.Network.SendPacket(new SharedSessionLeavePacket()); IsSessionActive = false; NebulaClient.Navigate(typeof(SharedSessionsPage)); }
public async void Search(string query) { NebulaClient.Session.AddBrowserSearch(SearchBox.Text); Medias.Clear(); IAsyncEnumerable <IMediaInfo> medias = NebulaClient.Search(query); await foreach (IMediaInfo mediaInfo in medias) { Medias.Add(mediaInfo); } }
private void OnReceiveSharedSessions(SharedSessionsPollResponse response, NebulaNetClient net) { NebulaClient.Invoke(() => { ListView.Items.Clear(); foreach (SharedSessionInfo sessionInfo in response.Sessions) { ListView.Items.Add(sessionInfo); } }); }
private async void OnMediaItemAuthorMouseUp(object sender, MouseButtonEventArgs e) { if (!(sender is TextBlock clicked) || !(clicked.DataContext is IMediaInfo mediaInfo)) { return; } IArtistInfo artistInfo = await mediaInfo.GetArtistInfo(); UnknownPlaylist playlist = await UnknownPlaylist.FromArtist(artistInfo, false); NebulaClient.Navigate(typeof(PlaylistPage), playlist, new DrillInNavigationTransitionInfo()); }
void OnEnable() { _gameObjectDirector = new GameObjectDirector(new Dictionary <string, GameObject> { { Prefab.name, Prefab } }); _transmissionProtocol = new TcpClientTransmissionProtocol(Ip, Port); _transmissionProtocol.Start(); _nebula = new NebulaClient(new RecorderInputSender(_transmissionProtocol, new RecordedInputSerializer()), new PacketReciver(_transmissionProtocol, SetupPacketSerializer()), new InputRecorder()); }
public PlaylistEditDialog(IPlaylist playlist) { Playlist = playlist; Title = NebulaClient.GetLocString("EditPlaylist"); PrimaryButtonText = NebulaClient.GetLocString("Edit"); Name = playlist.Name; Description = playlist.Description; Author = playlist.Author; string thumbnailUri = playlist.Thumbnail.ToString(); Thumbnail = thumbnailUri.StartsWith("file") ? playlist.Thumbnail.LocalPath : thumbnailUri; Cache.PrepareFor(this); }
public override void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo) { ServerPeer = null; NebulaClient.BeginInvoke(() => { NebulaClient.Notifications.NotifyOk("", "ServerConnectionLost", "#ff0000"); Disconnected?.Invoke(this, new DisconnectedFromServerEventArgs(peer, disconnectInfo)); if (!NebulaClient.SharedSession.IsSessionActive) { return; } NebulaClient.SharedSession.Leave(); }); }
private void OnPlayerStateChanged(object sender, StateChangedEventArgs e) { switch (e.NewState) { case MediaPlayerState.Paused: PlaybackPlay.Icon = new SymbolIcon(Symbol.Play); PlaybackPlay.Label = NebulaClient.GetLocString("Play"); break; case MediaPlayerState.Playing: PlaybackPlay.Icon = new SymbolIcon(Symbol.Pause); PlaybackPlay.Label = NebulaClient.GetLocString("Pause"); break; } }
private void OnPlayerMuteChanged(object sender, MuteChangedEventArgs e) { if (e.IsMuted) { PlaybackMute.IsChecked = true; PlaybackMute.Icon = new SymbolIcon(Symbol.Mute); PlaybackMute.Label = NebulaClient.GetLocString("Unmute"); } else { PlaybackMute.IsChecked = false; PlaybackMute.Icon = new SymbolIcon(Symbol.Volume); PlaybackMute.Label = NebulaClient.GetLocString("Mute"); } }
public void NotifyOk(string badgeKey, string contentKey, string accentColor = "#1751C3", params object[] args) { NotificationsManager.CreateMessage() .Animates(true) .AnimationInDuration(0.75) .AnimationOutDuration(0.25) .Accent(accentColor) .Background("#333") .HasBadge(string.IsNullOrWhiteSpace(badgeKey) ? NebulaClient.GetLocString("NotificationsBadgeInfo") : NebulaClient.GetLocString(badgeKey)) .HasMessage(NebulaClient.GetLocString(contentKey, args)) .Dismiss().WithButton(NebulaClient.GetLocString("ButtonOk"), button => { }) .Queue(); }
private void OnContextMenuAddModule(object sender, RoutedEventArgs e) { NebulaClient hClient = m_hClientList.SelectedItem as NebulaClient; Microsoft.Win32.OpenFileDialog hDlg = new Microsoft.Win32.OpenFileDialog(); hDlg.FileName = "Nebula Module"; hDlg.DefaultExt = ".dll"; hDlg.Filter = "Assembly Files (.dll)|*.dll"; if (hDlg.ShowDialog() == true) { byte[] hData = File.ReadAllBytes(hDlg.FileName); NebulaModuleInfo[] hModules = hClient.Callback.AddModule(hData); } }
private void OnReceiveSharedSessionUserJoin(SharedSessionUserJoinedPacket response, NebulaNetClient net) { if (!IsSessionActive) { return; } NebulaClient.BeginInvoke(() => { if (IsUserPresent(response.User)) { return; } Users.Add(response.User); AddMessage(new SharedSessionMessage(FindUserById(response.User.Id), NebulaClient.GetLocString("SharedSessionMessageUserJoined"), "#10b513")); }); }
public override void OnPeerConnected(NetPeer peer) { ServerPeer = peer; SendPacket(new UserInfoPacket { UserInfo = new UserInfo { Id = -1, Username = NebulaClient.Settings.UserProfile.Username, AvatarUrl = NebulaClient.Settings.UserProfile.Avatar, } }); if (Connected != null) { NebulaClient.Invoke(() => Connected.Invoke(this, new ConnectedToServerEventArgs(peer))); } }
private void OnReceiveSharedSessionUserLeft(SharedSessionUserLeftPacket response, NebulaNetClient net) { if (!IsSessionActive) { return; } NebulaClient.BeginInvoke(() => { UserInfo listUser = FindUserById(response.User.Id); if (listUser == UserInfo.Empty) { return; } Users.Remove(listUser); AddMessage(new SharedSessionMessage(listUser, NebulaClient.GetLocString("SharedSessionMessageUserLeft"), "#fc0000")); }); }
private void OnMediaChanged(object sender, MediaChangedEventArgs e) { IMediaProvider mediaProvider = e.NewMedia.GetMediaProvider(); MediaThumbnail.Source = new BitmapImage(new Uri(e.NewMedia.ThumbnailUrl)); MediaTitle.Text = e.NewMedia.Title; MediaAuthor.Text = e.NewMedia.Author; MediaProvider.Text = mediaProvider.Name; MediaProvider.Foreground = new SolidColorBrush((Color)(ColorConverter.ConvertFromString(mediaProvider.NameColorEx) ?? Colors.Gray)); PlaybackPosition.Minimum = 0; PlaybackPosition.Maximum = e.NewMedia.Duration.TotalSeconds; PlaybackRemaining.Text = e.NewMedia.Duration.ToString(); PlaybackVolume.Value = NebulaClient.MediaPlayer.Volume; PlaybackPlay.Icon = new SymbolIcon(Symbol.Pause); PlaybackPlay.Label = NebulaClient.GetLocString("Pause"); UpdateMediaInfoWidth(); }
private void OnClientContextMenuOpen(object sender, ContextMenuEventArgs e) { NebulaClient hClient = m_hClientList.SelectedItem as NebulaClient; if (hClient == null) { return; } //Detach previous event handlers foreach (Control hItem in m_hClientContextMenu.Items) { if (hItem is MenuItem) { foreach (MenuItem hServerItem in (hItem as MenuItem).Items) { hServerItem.Click -= ServerMenuItemClick; } } } //Clear the menu m_hClientContextMenu.Items.Clear(); //Fill It Again m_hNebulaModuleControlHandles.ForEach(x => m_hClientContextMenu.Items.Add(x)); foreach (NebulaModuleInfo hModuleInfo in hClient.Modules) { MenuItem hMenuItem = new MenuItem(); hMenuItem.Header = hModuleInfo.Name; m_hClientContextMenu.Items.Add(hMenuItem); foreach (NebulaModuleMethod hMethod in hModuleInfo.Methods) { MenuItem hMethodItem = new ServerMenuItem(); hMethodItem.Header = hMethod.Name; hMethodItem.Tag = hModuleInfo; hMethodItem.Click += ServerMenuItemClick; hMenuItem.Items.Add(hMethodItem); } } }
public override void OnPrimaryClick() { string oldName = Playlist.Name; Playlist.Name = Name; Playlist.Description = Description; Playlist.Author = Author; Playlist.Thumbnail = string.IsNullOrWhiteSpace(Thumbnail) ? null : new Uri(Thumbnail); if (oldName != Playlist.Name) { NebulaClient.Playlists.RenamePlaylist(oldName, Playlist); } else { NebulaClient.Playlists.SavePlaylist(Playlist); } NebulaClient.Navigate(typeof(PlaylistPage), Playlist); }
public static DataContentCache BuildCache(Type type) { DataContentCache dataContentCache = new DataContentCache(type); Type frameworkType = typeof(FrameworkElement); foreach (PropertyInfo propertyInfo in type.GetProperties(PropertyBindingFlags).OrderBy(p => p.GetCustomAttribute <DataProperty>()?.Order)) { DataProperty dataProperty = propertyInfo.GetCustomAttribute <DataProperty>(); if (dataProperty == null || !frameworkType.IsAssignableFrom(dataProperty.ControlType)) { continue; } ConstructorInfo ctor = dataProperty.ControlType.GetConstructor(new[] { typeof(object[]) }); FrameworkElement frameworkElement; if (ctor == null) { frameworkElement = (FrameworkElement)Activator.CreateInstance(dataProperty.ControlType); } else { frameworkElement = (FrameworkElement)Activator.CreateInstance(dataProperty.ControlType, dataProperty.Params); } if (frameworkElement == null) { continue; } DataCategory dataCategory = propertyInfo.GetCustomAttribute <DataCategory>(); if (dataCategory != null) { dataContentCache.AddElement(new TextBlock { Text = NebulaClient.GetLocString(dataCategory.Category), FontSize = 24 }); } DependencyProperty dependencyProperty = null; BaseControlHandler.HandleControl(frameworkElement, propertyInfo, dataCategory, dataProperty, ref dependencyProperty); HandleControl(frameworkElement, propertyInfo, dataCategory, dataProperty, ref dependencyProperty); dataContentCache.AddElement(frameworkElement, dependencyProperty, propertyInfo); } return(dataContentCache); }
public override async void OnPrimaryClick() { if (string.IsNullOrWhiteSpace(Path)) { return; } IPlaylist playlist; if (Path.Contains("http") && Path.Contains("youtube")) { playlist = await NebulaClient.GetMediaProvider <YoutubeMediaProvider>().GetPlaylist(Path); NebulaClient.Playlists.AddPlaylist(playlist); } else { playlist = NebulaClient.Playlists.LoadPlaylist(new FileInfo(Path)); NebulaClient.Playlists.SavePlaylist(playlist); } await NebulaMessageBox.ShowOk("PlaylistImport", "PlaylistImported", playlist.Name); }