Internat.cs :  » GUI » wx-NET » wx » SampleInternat » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GUI » wx NET 
wx NET » wx » SampleInternat » Internat.cs
//-----------------------------------------------------------------------------
// wx.NET/Samples - Internat.cs
//
// A wx.NET version of the wxWidgets "internat" sample.
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 by Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: Internat.cs,v 1.4 2007/12/08 23:11:22 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Drawing;

/** Use of \c gettext repositories.
 */
namespace wx.SampleInternat{
  public class MyFrame : wx.Frame
  {
    enum Cmd
    { 
      About, 
      Quit, 
      Dialog,
      INTERNAT_TEXT,
          INTERNAT_TEST,
          INTERNAT_TEST_1,
          INTERNAT_TEST_2,
          INTERNAT_TEST_3,
          INTERNAT_OPEN 
    }
    
    protected Locale m_locale;

    //---------------------------------------------------------------------

    public MyFrame(Locale locale)
      : base( null, -1, _("International wxWidgets App") )
    {
      m_locale = locale;
      
      // Set the window icon

      Icon = new wx.Icon("../Samples/Internat/mondrian.png");

      // Set up a menu

      Menu fileMenu = new Menu();
      fileMenu.AppendWL( (int)Cmd.About, _("&About..."), new EventListener(OnAbout) );
      fileMenu.AppendSeparator();
      fileMenu.AppendWL( (int)Cmd.Quit, _("E&xit"), new EventListener(OnQuit) );

      wx.MenuBar menuBar = new wx.MenuBar();
      menuBar.Append( fileMenu, _("&File") );

      MenuBar = menuBar;
    }

    //---------------------------------------------------------------------

    public void OnQuit(object sender, Event e)
    {
      Close();
    }

    //---------------------------------------------------------------------

    public void OnAbout(object sender, Event e)
    {
      string locale = m_locale.GetLocale();
      string sysname = m_locale.SysName;
      string canname = m_locale.CanonicalName;
      
      string localeInfo = String.Format( _("Language: {0}\nSystem locale name:\n{1}\nCanonical locale name: {2}\n"),
          locale, sysname, canname );
    
      string msg = _("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart");
      msg += _("\nPorted 2004 to wx.NET by Alexander Olk\n\n");
      msg += localeInfo;
      MessageDialog.ShowModal(this, msg, _("About Internat"), Dialog.wxOK | Dialog.wxICON_INFORMATION);
    }
  }



  public class Internat : wx.App
  {
    public static Language[] langIds =
    {
      Language.wxLANGUAGE_DEFAULT,
      Language.wxLANGUAGE_FRENCH,
      Language.wxLANGUAGE_GERMAN,
      Language.wxLANGUAGE_RUSSIAN,
      Language.wxLANGUAGE_BULGARIAN,
      Language.wxLANGUAGE_CZECH,
      Language.wxLANGUAGE_POLISH,
      Language.wxLANGUAGE_JAPANESE,
      Language.wxLANGUAGE_GEORGIAN,
      Language.wxLANGUAGE_ENGLISH,
      Language.wxLANGUAGE_ENGLISH_US
    };
  
    protected Locale m_locale = new Locale();
    
    public string[] st_args;
  
    //---------------------------------------------------------------------

    public override bool OnInit()
    {
      int lng = -1;
      
      if ( st_args.Length == 1 )
      {
        lng = System.Convert.ToInt32( st_args[0] );
      }
      
      if ( lng == -1 )
      {
        string[] langNames =
        {
          "System default",
          "French",
          "German",
          "Russian",
          "Bulgarian",
          "Czech",
          "Polish",
          "Japanese",
          "Georgian",
          "English",
          "English (U.S.)"
        };
        
        lng = Utils.GetSingleChoiceIndex( _("Please choose language:"), _("Language"), langNames );
      }
      
      if ( lng != -1 )
        m_locale.Init(langIds[lng]);
      m_locale.AddCatalogLookupPathPrefix("../Samples/Internat");
      if (!m_locale.AddCatalog( "internat" ))
      {
        MessageDialog.MessageBox("Failed to read catalog.", "Error on load.", Dialog.wxICON_ERROR | Dialog.wxSTAY_ON_TOP);
      }    
      MyFrame frame = new MyFrame(m_locale);
      frame.Show(true);

      return true;
    }

    //---------------------------------------------------------------------

    [STAThread]
    static void Main( string[] args )
    {
      Internat app = new Internat();
      app.st_args = args;
      app.Run();
    }

    //---------------------------------------------------------------------
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.