Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 public MainForm(PeerCast peercast)
 {
     InitializeComponent();
     Settings.Default.PropertyChanged += SettingsPropertyChanged;
     Logger.Level = LogLevel.Warn;
     Logger.AddWriter(new DebugWriter());
     guiWriter = new TextBoxWriter(logText);
     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();
     }
     peerCast = peercast;
     peerCast.ChannelAdded     += ChannelAdded;
     peerCast.ChannelRemoved   += ChannelRemoved;
     logLevelList.SelectedIndex = Settings.Default.LogLevel;
     logToFileCheck.Checked     = Settings.Default.LogToFile;
     logFileNameText.Text       = Settings.Default.LogFileName;
     logToConsoleCheck.Checked  = Settings.Default.LogToConsole;
     logToGUICheck.Checked      = Settings.Default.LogToGUI;
     OnUpdateSettings(null);
     timer.Interval = 1000;
     timer.Enabled  = true;
     timer.Tick    += (sender, args) => {
         UpdateStatus();
     };
     UpdateStatus();
 }