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"));
       }
 }
Exemplo n.º 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))
       );
 }
Exemplo n.º 4
0
 public void Start(PeerCastApplication app)
 {
     Logger.AddWriter(logWriter);
       application = app;
       factory = new APIHostOutputStreamFactory(this, app.PeerCast);
       application.PeerCast.OutputStreamFactories.Add(factory);
 }
Exemplo n.º 5
0
 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;
        }
Exemplo n.º 7
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;
   };
 }
 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();
 }
Exemplo n.º 9
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();
 }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 12
0
 public void Detach()
 {
     OnDetach();
     application = null;
 }
Exemplo n.º 13
0
 public void Attach(PeerCastApplication app)
 {
     application = app;
     OnAttach();
 }
Exemplo n.º 14
0
 internal static void ShowDialog(Window owner, PeerCastApplication app)
 {
   var window = new SettingsDialog(app);
   window.Owner = owner;
   window.ShowDialog();
 }
Exemplo n.º 15
0
 internal OtherSettingViewModel(PeerCastApplication peca_app)
 {
     pecaApp = peca_app;
 }
Exemplo n.º 16
0
        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");
              };
        }
Exemplo n.º 17
0
 public void Attach(PeerCastApplication app)
 {
     application = app;
       OnAttach();
 }
Exemplo n.º 18
0
 public void Detach()
 {
     OnDetach();
       application = null;
 }
Exemplo n.º 19
0
 public PeerCastApplication()
 {
   if (current==null) current = this;
 }