示例#1
0
      ///
      /// \param settings is directly modified by ConfigDlg when OK is
      ///   pressed
      ///
      public ConfigDlg( PlayerSettings settings )
      {
         _settings = settings;

         Response += new ResponseHandler( _OnResponse );

         AddButton( "Ok", (int)ResponseType.Ok );
         AddButton( "Cancel", (int)ResponseType.Cancel );

         // Now for the state editing controls:
         VBox.Add( new Label( "Suck" ) );

         _serverName = new Entry();
         _serverName.ActivatesDefault = true;
         _serverName.Text = _settings.serverName;
         VBox.Add( _serverName );

         _serverPort = new Entry();
         _serverPort.ActivatesDefault = true;
         _serverPort.Text = _settings.serverPort.ToString();
         VBox.Add( _serverPort );

         VBox.ShowAll();
      }
示例#2
0
        ///
        /// Constructs the GtkPlayer from compiled-in Glade.XML resources
        ///
        public GtkPlayer()
        {
            _Trace( "Loading Glade.XML" );

             //
             // With the null first parameter, this callw ill try to load
             // our resources as if they were compiled in. Which they are.
             // Right?
             //
             Glade.XML glade = new Glade.XML( null,
                                          "tam.GtkPlayer.exe.glade",
                                          "_mainWindow",
                                          null );

             _Trace( "autoconnect" );
             glade.Autoconnect( this );
             _mainWindow = (Gtk.Window)glade.GetWidget( "_mainWindow" );
             Debug.Assert( null != _mainWindow );

             _Trace( "fetching settings" );
             try
             {
            _settings = PlayerSettings.Fetch();
             }
             catch (Exception e)
             {
            _Status( "Note: Could not load settings, using defaults: "
                     + e.Message,
                     35 );

            _settings = new PlayerSettings();
            _settings.serverName = "localhost";
            _settings.serverPort = 6543;
             }

             PlayerApp.connectionString = _settings.connectString;

             PlayerApp.mp3RootDir = _settings.mp3RootDir;

             PlayerApp.serverUrl =
            "tcp://" + _settings.serverName + ":"
            + _settings.serverPort + "/Engine";

             _SetUpControls();

             // Load application icon here if possible, save for later use
             // in dialogs.
            //          Gdk.Pixbuf icon = new Gdk.Pixbuf( Assembly.GetExecutingAssembly(),
            //                                            "appicon.png" );
            //
            //          Debug.Assert( null != icon );
            //          _mainWindow.Icon = icon;
            //          _configWindow.Icon = icon;
            //          _whoAreYouWindow.Icon = icon;

             // Background processing callback
             Gtk.Timeout.Add( 2000, new Gtk.Function( _PollingCallback ) );
        }