コード例 #1
0
ファイル: MainClass.cs プロジェクト: cyberthrone/monosim
		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();
			
		}
コード例 #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();
        }