Пример #1
0
        internal static void ShowDialog(Window owner, PeerCastApplication app)
        {
            var window = new SettingsDialog(app);

            window.Owner = owner;
            window.ShowDialog();
        }
Пример #2
0
 public void Start(PeerCastApplication app)
 {
     Logger.AddWriter(logWriter);
     application = app;
     factory     = new APIHostOutputStreamFactory(this, app.PeerCast);
     application.PeerCast.OutputStreamFactories.Add(factory);
 }
Пример #3
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;
            }
        }
Пример #4
0
        internal SettingsDialog(PeerCastApplication app)
        {
            var viewmodel = new SettingViewModel(app);

            this.viewModel   = viewmodel;
            this.DataContext = viewmodel;
            InitializeComponent();
        }
        internal PeerCastAppViewModel(PeerCastApplication application)
        {
            this.application = application;
            var peerCast = application.PeerCast;

            channelList = new ChannelListViewModel(peerCast);
            peerCast.AddChannelMonitor(this);
        }
Пример #6
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;
                }
            });
        }
Пример #7
0
        public static void BuildApp(IAppBuilder builder, PeerCastApplication application)
        {
            var app = new YPChannelsHostOwinApp(application);

            builder.MapGET("/ypchannels/index.txt", sub => {
                sub.UseAuth(OutputStreamType.Interface);
                sub.Run(app.Invoke);
            });
        }
Пример #8
0
        internal PeerCastAppViewModel(PeerCastApplication application)
        {
            this.application = application;
            settings         = application.Settings.Get <WPFSettings>();
            var peerCast = application.PeerCast;

            channelList = new ChannelListViewModel(peerCast);
            peerCast.AddChannelMonitor(this);
            WindowTitle = CreateWindowTitle();
        }
Пример #9
0
 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;
     };
 }
Пример #10
0
        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;
        }
Пример #11
0
        public static void BuildApp(IAppBuilder builder, PeerCastApplication application)
        {
            var app = new YPChannelsHostOwinApp(application);

            builder.Map("/ypchannels/index.txt", sub => {
                sub.UseAllowMethods("GET");
                sub.MapMethod("GET", withmethod => {
                    withmethod.UseAuth(OutputStreamType.Interface);
                    withmethod.Run(app.Invoke);
                });
            });
        }
Пример #12
0
 public PeerCastOwinAppBuilder(PeerCastApplication app, PeerCast peerCast, CancellationToken cancellationToken)
 {
     Application = app;
     PeerCast    = peerCast;
     Properties[OwinEnvironment.Owin.Version]   = "1.0.1";
     Properties[OwinEnvironment.Opaque.Version] = "1.0";
     Properties[OwinEnvironment.PeerCastStation.PeerCastApplication] = app;
     Properties[OwinEnvironment.PeerCastStation.PeerCast]            = peerCast;
     Properties[OwinEnvironment.Server.OnInit]       = new Action <Func <Task> >(func => onInitActions.Add(func));
     Properties[OwinEnvironment.Server.OnDispose]    = cancellationToken;
     Properties[OwinEnvironment.Server.Capabilities] = Capabilities;
     Properties[OwinEnvironment.Host.TraceOutput]    = TextWriter.Null;
     Properties[OwinEnvironment.Host.Addresses]      = new List <Dictionary <string, object> >();
 }
Пример #13
0
 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();
 }
Пример #14
0
 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();
 }
Пример #15
0
 public VersionInfoViewModel(PeerCastApplication app)
 {
     this.AgentName = AppSettingsReader.GetString("AgentName", "PeerCastStation/Unknown");
     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();
 }
        internal SettingsDialog(PeerCastApplication app)
        {
            var viewmodel = new SettingViewModel(app);

            this.viewModel   = viewmodel;
            this.DataContext = viewmodel;
            OKCommand        = new Commons.Command(() => {
                viewModel.Apply();
                this.Close();
            }, () => errorControls.Count == 0);
            CancelCommand = new Commons.Command(() => {
                this.Close();
            });
            ApplyCommand = new Commons.Command(() => {
                viewModel.Apply();
            }, () => viewModel.IsModified && errorControls.Count == 0);
            viewModel.PropertyChanged += ViewModel_PropertyChanged;
            InitializeComponent();
        }
Пример #17
0
 public OwinHost(PeerCastApplication application, PeerCast peerCast)
 {
     Application = application;
     PeerCast    = peerCast;
 }
Пример #18
0
 public void Start(PeerCastApplication app)
 {
     application = app;
     factory     = new HTMLHostOutputStreamFactory(this, application.PeerCast);
     application.PeerCast.OutputStreamFactories.Add(factory);
 }
Пример #19
0
 public YPChannelsHostOwinApp(PeerCastApplication application)
 {
     Application = application;
 }
Пример #20
0
 public ChannelNotifier(PeerCastApplication app)
 {
     this.app = app;
     this.messageExpireTimer.Start();
 }