예제 #1
0
        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.PortMapper>();

            if (port_mapper != null)
            {
                portMapperEnabled = port_mapper.Enabled;
            }
        }
예제 #2
0
 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))
       );
 }
예제 #3
0
        internal SettingViewModel(PeerCastApplication peca_app)
        {
            this.pecaApp                 = peca_app;
            this.peerCast                = peca_app.PeerCast;
            this.AddPortCommand          = new Command(() => AddPort(PrimaryPort, NetworkType.IPv4));
            this.RemovePortCommand       = new Command(() => RemovePort(), () => SelectedPort != null);
            this.AddYellowPageCommand    = new Command(() => AddYellowPage());
            this.RemoveYellowPageCommand = new Command(() => RemoveYellowPage(), () => SelectedYellowPage != null);
            channelCleanupMode           = ChannelCleaner.Mode;
            channelCleanupInactiveLimit  = ChannelCleaner.InactiveLimit / 60000;
            maxRelays = peerCast.AccessController.MaxRelays;
            maxRelaysPerBroadcastChannel = peerCast.AccessController.MaxRelaysPerBroadcastChannel;
            maxRelaysPerRelayChannel     = peerCast.AccessController.MaxRelaysPerRelayChannel;
            maxPlays = peerCast.AccessController.MaxPlays;
            maxPlaysPerBroadcastChannel        = peerCast.AccessController.MaxPlaysPerBroadcastChannel;
            maxPlaysPerRelayChannel            = peerCast.AccessController.MaxPlaysPerRelayChannel;
            maxUpstreamRate                    = peerCast.AccessController.MaxUpstreamRate;
            maxUpstreamRateIPv6                = peerCast.AccessController.MaxUpstreamRateIPv6;
            maxUpstreamRatePerBroadcastChannel = peerCast.AccessController.MaxUpstreamRatePerBroadcastChannel;
            maxUpstreamRatePerRelayChannel     = peerCast.AccessController.MaxUpstreamRatePerRelayChannel;
            isShowWindowOnStartup              = pecaApp.Settings.Get <WPFSettings>().ShowWindowOnStartup;
            isShowNotifications                = pecaApp.Settings.Get <WPFSettings>().ShowNotifications;
            remoteNodeName = pecaApp.Settings.Get <WPFSettings>().RemoteNodeName;
            ports          = new ObservableCollection <OutputListenerViewModel>(
                peerCast.OutputListeners
                .Select(listener => new OutputListenerViewModel(this, listener))
                );
            ports.CollectionChanged += (sender, args) => {
                OnPropertyChanged(nameof(ExternalAddressesV6));
                OnPropertyChanged(nameof(IPv6Enabled));
            };
            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"));
            }
            PortCheckStatus   = PortCheckStatus.Checking;
            PortCheckV6Status = PortCheckStatus.Checking;
            CheckPortAsync().ContinueWith(prev => {
                if (prev.IsCanceled || prev.IsFaulted)
                {
                    PortCheckStatus   = PortCheckStatus.Failed;
                    PortCheckV6Status = PortCheckStatus.Failed;
                }
                else
                {
                    PortCheckStatus   = prev.Result.ResultV4;
                    PortCheckV6Status = prev.Result.ResultV6;
                }
            });
        }
 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"));
       }
 }