internal SettingsDialog(PeerCastApplication app) { var viewmodel = new SettingViewModel(app); this.viewModel = viewmodel; this.DataContext = viewmodel; InitializeComponent(); }
internal SettingViewModel(PeerCastApplication peca_app) { this.pecaApp = peca_app; this.peerCast = peca_app.PeerCast; this.AddPortCommand = new Command(() => AddPort()); this.RemovePortCommand = new Command(() => RemovePort(), () => SelectedPort!=null); this.AddYellowPageCommand = new Command(() => AddYellowPage()); this.RemoveYellowPageCommand = new Command(() => RemoveYellowPage(), () => SelectedYellowPage!=null); this.CheckBandwidth = new CheckBandwidthCommand(this); channelCleanupMode = ChannelCleaner.Mode; channelCleanupInactiveLimit = ChannelCleaner.InactiveLimit/60000; maxRelays = peerCast.AccessController.MaxRelays; maxRelaysPerChannel = peerCast.AccessController.MaxRelaysPerChannel; maxPlays = peerCast.AccessController.MaxPlays; maxPlaysPerChannel = peerCast.AccessController.MaxPlaysPerChannel; maxUpstreamRate = peerCast.AccessController.MaxUpstreamRate; maxUpstreamRatePerChannel = peerCast.AccessController.MaxUpstreamRatePerChannel; isShowWindowOnStartup = pecaApp.Settings.Get<WPFSettings>().ShowWindowOnStartup; ports = new ObservableCollection<OutputListenerViewModel>( peerCast.OutputListeners .Select(listener => new OutputListenerViewModel(this, listener)) ); yellowPages = new ObservableCollection<YellowPageClientViewModel>( peerCast.YellowPages .Select(yp => new YellowPageClientViewModel(this, yp)) ); var port_mapper = pecaApp.Plugins.GetPlugin<PeerCastStation.UI.PortMapperPlugin>(); if (port_mapper!=null) { portMapperEnabled = port_mapper.Enabled; port_mapper.DiscoverAsync() .ContinueWith(prev => OnPropertyChanged("PortMapperExternalAddresses")); } }
internal SettingViewModel(PeerCastApplication peca_app) { this.pecaApp = peca_app; this.peerCast = peca_app.PeerCast; this.AddPortCommand = new Command(() => AddPort()); this.RemovePortCommand = new Command(() => RemovePort(), () => SelectedPort!=null); this.AddYellowPageCommand = new Command(() => AddYellowPage()); this.RemoveYellowPageCommand = new Command(() => RemoveYellowPage(), () => SelectedYellowPage!=null); this.CheckBandwidth = new CheckBandwidthCommand(this); channelCleanupMode = ChannelCleaner.Mode; channelCleanupInactiveLimit = ChannelCleaner.InactiveLimit/60000; maxRelays = peerCast.AccessController.MaxRelays; maxRelaysPerChannel = peerCast.AccessController.MaxRelaysPerChannel; maxPlays = peerCast.AccessController.MaxPlays; maxPlaysPerChannel = peerCast.AccessController.MaxPlaysPerChannel; maxUpstreamRate = peerCast.AccessController.MaxUpstreamRate; maxUpstreamRatePerChannel = peerCast.AccessController.MaxUpstreamRatePerChannel; isShowWindowOnStartup = pecaApp.Settings.Get<WPFSettings>().ShowWindowOnStartup; ports = new ObservableCollection<OutputListenerViewModel>( peerCast.OutputListeners .Select(listener => new OutputListenerViewModel(this, listener)) ); yellowPages = new ObservableCollection<YellowPageClientViewModel>( peerCast.YellowPages .Select(yp => new YellowPageClientViewModel(this, yp)) ); }
public void Start(PeerCastApplication app) { Logger.AddWriter(logWriter); application = app; factory = new APIHostOutputStreamFactory(this, app.PeerCast); application.PeerCast.OutputStreamFactories.Add(factory); }
public PeerCastApplication() { if (current == null) { current = this; } }
internal PeerCastAppViewModel(PeerCastApplication application) { this.application = application; var peerCast = application.PeerCast; channelList = new ChannelListViewModel(peerCast); setting = new SettingViewModel(application); peerCast.ChannelAdded += OnChannelChanged; peerCast.ChannelRemoved += OnChannelChanged; }
public ChannelNotifier(PeerCastApplication app) { this.app = app; this.messageExpireTimer.Start(); this.app.PeerCast.ChannelAdded += (sender, args) => { args.Channel.Closed += OnChannelClosed; }; this.app.PeerCast.ChannelRemoved += (sender, args) => { args.Channel.Closed -= OnChannelClosed; }; }
public VersionInfoViewModel(PeerCastApplication app) { items = app.Plugins.Select(plugin => { var info = plugin.GetVersionInfo(); return new { Name = plugin.Name, IsUsable = plugin.IsUsable, FileName = info.FileName, Version = info.Version, AssemblyName = info.AssemblyName, Copyright = info.Copyright, }; }).ToArray(); }
public void Start(PeerCastApplication app) { System.Windows.Forms.Application.EnableVisualStyles(); mainThread = new Thread(() => { mainForm = new MainForm(app.PeerCast); System.Windows.Forms.Application.ApplicationExit += (sender, args) => { app.Stop(); }; System.Windows.Forms.Application.Run(mainForm); mainForm = null; }); mainThread.SetApartmentState(ApartmentState.STA); mainThread.Start(); }
internal MainViewModel(PeerCastApplication application) { this.application = application; var peerCast = application.PeerCast; channelList = new ChannelListViewModel(peerCast); setting = new SettingViewModel(application); timer = new DispatcherTimer( TimeSpan.FromSeconds(1), DispatcherPriority.Normal, (sender, e) => UpdateStatus(), Application.Current.Dispatcher); peerCast.ChannelAdded += OnChannelChanged; peerCast.ChannelRemoved += OnChannelChanged; }
public MainForm(PeerCastApplication app) { InitializeComponent(); application = app; peerCast = app.PeerCast; if (PlatformID.Win32NT==Environment.OSVersion.Platform) { notifyIcon = new NotifyIcon(this.components); notifyIcon.Icon = this.Icon; notifyIcon.ContextMenuStrip = notifyIconMenu; notifyIcon.Visible = true; notifyIcon.DoubleClick += showGUIMenuItem_Click; notifyIcon.BalloonTipClicked += notifyIcon_BalloonTipClicked; versionChecker = new AppCastReader( new Uri(Settings.Default.UpdateURL, UriKind.Absolute), Settings.Default.CurrentVersion); versionChecker.NewVersionFound += versionChecker_Found; versionChecker.CheckVersion(); } var settings = application.Settings.Get<GUISettings>(); this.Visible = settings.ShowWindowOnStartup; }
public void Detach() { OnDetach(); application = null; }
public void Attach(PeerCastApplication app) { application = app; OnAttach(); }
internal static void ShowDialog(Window owner, PeerCastApplication app) { var window = new SettingsDialog(app); window.Owner = owner; window.ShowDialog(); }
internal OtherSettingViewModel(PeerCastApplication peca_app) { pecaApp = peca_app; }
internal SettingViewModel(PeerCastApplication peca_app) { this.peerCast = peca_app.PeerCast; otherSetting = new OtherSettingViewModel(peca_app); ports.ItemRemoving += (sender, e) => { peerCast.StopListen(e.Item.Model); OnPropertyChanged("Ports"); }; yellowPagesList.ItemRemoving += (sender, e) => { peerCast.RemoveYellowPage(e.Item.YellowPageClient); OnPropertyChanged("YellowPagesList"); }; }
public PeerCastApplication() { if (current==null) current = this; }