Example #1
0
        //TODO:通过XML 反向生成需要的资源文件
        private void GetSystemUITypeByScreenDisplayMetrics()
        {
            DisplayMetrics dm = new DisplayMetrics();

            base.WindowManager.DefaultDisplay.GetMetrics(dm);
            //BUG 不能
            SystemType = Currentversion.UIType;
            if (SystemType == SystemUIType.JingTang)
            {
                //600*1024 是大一点的捷达车中控
                if (dm.WidthPixels == 1024 && dm.HeightPixels == 600)
                {
                    SystemType = SystemUIType.JingTang;
                }
                else
                {
                    SystemType = SystemUIType.JingTangJieDa;
                }
            }

            else if (SystemType == SystemUIType.DuoLun || SystemType == SystemUIType.DuoLunSensor)
            {
                if (dm.WidthPixels == 1024 && dm.HeightPixels == 600)
                {
                }
                else if (dm.WidthPixels == 800 && dm.HeightPixels == 480)
                {
                    //TODO:多伦的将根据屏幕进行自适应,公司没有这种分辨率机型。有问题可以及时解除屏蔽解决。
                    SystemType = SystemUIType.DuoLunJieDa;
                }
                else
                {
                    SystemType = SystemUIType.DuoLunJieDa;
                }
            }

            else if (SystemType == SystemUIType.HuaZhong || SystemType == SystemUIType.HuaZhongSmall)
            {
                if (dm.WidthPixels == 1024 && dm.HeightPixels == 600)
                {
                    SystemType = SystemUIType.HuaZhong;
                }
                else if (dm.WidthPixels == 800 && dm.HeightPixels == 480)
                {
                    SystemType = SystemUIType.HuaZhongSmall;
                }
                else
                {
                    SystemType = SystemUIType.HuaZhongSmall;
                }
            }
            else
            {
            }
            Currentversion.UIType = SystemType;
        }
Example #2
0
        //跳转到主页面
        public void StartMainActivity()
        {
            try
            {
                LogManager.WriteSystemLog("DBName:" + DBName);
                Intent intent = new Intent();
                intent.SetClass(this, typeof(MainActivity));
                //通过参数把数据库名称传递过去
                intent.PutExtra("DbName", DBName);
                //把考试界面同样传过去
                SystemUIType ActivityName = SystemUIType.DuoLun;

                if (DBName == DataBase.DuoLun)
                {
                    ActivityName = SystemUIType.DuoLunNew;
                }
                else if (DBName == DataBase.HuaZhong)
                {
                    ActivityName = SystemUIType.HuaZhong;
                }
                else if (DBName == DataBase.JingYing)
                {
                    ActivityName = SystemUIType.JingYing;
                }
                else if (DBName == DataBase.BeiYong)
                {
                    ActivityName = SystemUIType.DuoLunSensor;
                }
                string UIName = Enum.GetName(ActivityName.GetType(), ActivityName);
                intent.PutExtra("UIName", UIName);

                StartActivity(intent);
                Finish();
            }
            catch (Exception ex)
            {
                LogManager.WriteSystemLog(ex.Message);
            }
        }