示例#1
0
        public static void Main(string[] args)
        {
            AppNameVer = Assembly.GetExecutingAssembly().GetName().Name + " " +
                         Assembly.GetExecutingAssembly().GetName().Version.ToString();

            // check for help request
            if (new List <string>(args).Contains("--help"))
            {
                Console.WriteLine(GetHelpMsg());
                return;
            }

            Application.Init();

            retStr = GlobalObj.Initialize(args);

            // check for problems detected
            if (retStr != "")
            {
                // check for problem type
                if (!retStr.Contains("SCARD_"))
                {
                    // error detected (not scard problem)
                    ShowMessage(null, "ERROR", retStr, MessageType.Error);
                    return;
                }
                else
                {
                    // warning (scard problem, can use serial reader)
                    ShowMessage(null, "WARNING", retStr, MessageType.Warning);
                }
            }

            try
            {
                // try to set language
                GlobalObjUI.SetLanguage("monosim-gtk");
            }
            catch (Exception Ex)
            {
                // error detected
                log.Error("GlobalObjUI::SetLanguage: " + Ex.Message + "\r\n" + Ex.StackTrace);
                ShowMessage(null, "LANGUAGE SET ERROR", Ex.Message, MessageType.Error);
                return;
            }


            // create new Gtk Gui for application and show it
            MainWindowClass mwc = new MainWindowClass();

            mwc.Show();
            Application.Run();
        }
示例#2
0
        public static void Main(string[] args)
        {
            AppNameVer = Assembly.GetExecutingAssembly().GetName().Name + " " +
                         Assembly.GetExecutingAssembly().GetName().Version.ToString();

            // check for help request
            if (new List <string>(args).Contains("--help"))
            {
                Console.WriteLine(GetHelpMsg());
                return;
            }


            // Init resource class manager
            Q_INIT_RESOURCE("ResManager");


            // Create new Qyoto Application
            new QApplication(args);


            retStr = GlobalObj.Initialize(args);

            // check for problems detected
            if (retStr != "")
            {
                // check for problem type
                if (!retStr.Contains("SCARD_"))
                {
                    // error detected (not scard problem)
                    ShowMessage(null, "ERROR", retStr, MessageType.Error);
                    QApplication.Quit();
                    return;
                }
                else
                {
                    // warning (scard problem, can use serial reader)
                    ShowMessage(null, "WARNING", retStr, MessageType.Warning);
                }
            }

            try
            {
                // try to set language
                GlobalObjUI.SetLanguage("monosim-qt");
            }
            catch (Exception Ex)
            {
                // error detected
                log.Error("GlobalObjUI::SetLanguage: " + Ex.Message + "\r\n" + Ex.StackTrace);
                ShowMessage(null, "LANGUAGE SET ERROR", Ex.Message, MessageType.Error);
                return;
            }

            // Create new Qyoto Desktop Object
            QDesktopWidget qdw = new QDesktopWidget();

            // Create MainWindow class manager
            MainWindowClass mwc = new MainWindowClass();

            int wWidth  = Convert.ToInt32(mwc.Width() / 2);
            int wHeight = Convert.ToInt32(mwc.Height() / 2);
            int dWidth  = Convert.ToInt32(qdw.Width() / 2);
            int dHeight = Convert.ToInt32(qdw.Height() / 2);

            mwc.Move(dWidth - wWidth, dHeight - wHeight - 20);

            mwc.Show();


            // Run Qyoto Application
            QApplication.Exec();
        }