示例#1
0
        internal static WindowsType GetWindowsVersionType()
        {
            OperatingSystem oSVersion = Environment.OSVersion;
            WindowsType     none      = WindowsType.None;

            switch (oSVersion.Platform)
            {
            case PlatformID.Win32Windows:
                switch (oSVersion.Version.Minor)
                {
                case 0:
                    return(WindowsType.Windows95);

                case 10:
                    return(WindowsType.Windows98);

                case 90:
                    none = WindowsType.WindowsME;
                    break;
                }
                return(none);

            case PlatformID.Win32NT:
                switch (oSVersion.Version.Major)
                {
                case 3:
                    return(none);

                case 4:
                    return(WindowsType.WindowsNT4);

                case 5:
                    switch (oSVersion.Version.Minor)
                    {
                    case 0:
                        return(WindowsType.Windows2K);

                    case 1:
                        return(WindowsType.WindowsXP);

                    case 2:
                        return(WindowsType.Windows2003);
                    }
                    return(none);

                case 6:
                    switch (oSVersion.Version.Minor)
                    {
                    case 0:
                        return(WindowsType.WindowsVista);

                    case 1:
                        return(WindowsType.Windows7);
                    }
                    return(none);
                }
                return(none);
            }
            return(none);
        }
示例#2
0
        public static WindowsType GetWindowsType()
        {
            WindowsType type = WindowsType.Unknown;

            string query = "SELECT * FROM Win32_OperatingSystem";

            using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query)) {
                foreach (WindowsType item in Enum.GetValues(typeof(WindowsType)))
                {
                    foreach (ManagementObject info in searcher.Get())
                    {
                        if (info.Properties["Caption"].Value.ToString().Contains(StringEnum.GetStringValue(item)))
                        {
                            type = item;
                            break;
                        }

                        /*Console.WriteLine("caption : {0}, version : {1}, sp major : {2}, sp minor : {3}", info.Properties["Caption"].Value.ToString().Trim()
                         * , info.Properties["Version"].Value.ToString()
                         * , info.Properties["ServicePackMajorVersion"].Value.ToString()
                         * , info.Properties["ServicePackMinorVersion"].Value.ToString());*/
                    }
                }
            }

            return(type);
        }
        private void Changementfenetre(object arg1, WindowsType arg2)
        {
            switch (arg2)
            {
            case VMWindow.WindowsType.MenuWindow: MainWindow XE = new MainWindow();
                XE.ShowDialog();
                break;

            case VMWindow.WindowsType.DataGridWindowUtilisateur: C.Utilisateur E = new C.Utilisateur();
                E.ShowDialog();
                break;
            }
        }
示例#4
0
        public void Show(WindowsType type)
        {
            foreach (var chi in GridWindow.Children)
            {
                if (chi is UserControl)
                {
                    GridWindow.Children.Remove(chi as UserControl);
                }
            }
            object userobject = null;

            switch (type)
            {
            case WindowsType.Setting:
                userobject = new Setting();
                (userobject as Setting)._configure = _Configure;
                (userobject as Setting).Window     = this;
                break;

            case WindowsType.Wifi:
                userobject = new WIFISetting();
                (userobject as WIFISetting)._configure = _Configure;
                (userobject as WIFISetting).Window     = this;
                break;
            }
            if (userobject != null)
            {
                UserControl user = userobject as UserControl;
                Height                   = user.Height + ImageOk.Height;
                ViewGrid.Height          = user.Height;
                ViewGrid.Width           = user.Width;
                Width                    = user.Width;
                GridWindow.DataContext   = _Configure;
                user.HorizontalAlignment = HorizontalAlignment.Left;
                user.VerticalAlignment   = VerticalAlignment.Top;
                ViewGrid.Children.Add(user);

                (userobject as IButtonEvent).CloseEvent += (ss, ee) =>
                {
                    Close();
                };
                Show();
            }
        }
示例#5
0
文件: Runtime.cs 项目: umu24013/Chat
 private void PushEvent(WindowsType windowsType, bool canceled = false, string reason = "")
 {
     OnEvent(new BackendEventWindows("", windowsType, canceled, reason));
 }
示例#6
0
 private void PushEvent(WindowsType windowsType, bool canceled = false, string reason = "") { OnEvent(new BackendEventWindows("", windowsType, canceled, reason)); }
示例#7
0
文件: Events.cs 项目: rihardsk/Chat
 public BackendEventWindows(string id, WindowsType windowsType, bool canceled = false, string reason = "") : base(id, EventType.Windows)
 {
     WindowsType = windowsType; Canceled = canceled; Reason = reason;
 }
示例#8
0
        /**************************************************
         * 函数名称:GetOS()
         * 功能说明:获取获取操作系统版本
         * 参 数:
         * 使用示列:
         * Response.Write(EC.CpuInfoObject.GetOS());
         ************************************************/
        /// <summary>
        /// 获取操作系统版本
        /// </summary>
        /// <returns>操作系统版本</returns>
        public static WindowsType GetOS()
        {
            WindowsType Rev = WindowsType.Windows7;

            System.OperatingSystem osInfo = System.Environment.OSVersion;
            switch (osInfo.Platform)
            {
            //Platform is Windows 95, Windows 98,Windows 98 Second Edition, or Windows Me.
            case System.PlatformID.Win32Windows:
                switch (osInfo.Version.Major)
                {
                case 0:
                    Rev = WindowsType.Windows95;
                    break;

                case 10:
                    if (osInfo.Version.Revision.ToString() == "2222A")
                    {
                        Rev = WindowsType.Windows98SecondEdition;
                    }
                    else
                    {
                        Rev = WindowsType.Windows98;
                    }
                    break;

                case 90:
                    Rev = WindowsType.WindowsMe;
                    break;
                }
                break;

            //Platform is Windows NT 3.51, Windows NT 4.0, Windows 2000,or Windows XP.
            case System.PlatformID.Win32NT:
                switch (osInfo.Version.Major)
                {
                case 3:
                    Rev = WindowsType.WindowsNT351;
                    break;

                case 4:
                    Rev = WindowsType.WindowsNT40;
                    break;

                case 5:
                    if (osInfo.Version.Minor == 0)
                    {
                        Rev = WindowsType.Windows2000;
                    }
                    else if (osInfo.Version.Minor == 2)
                    {
                        Rev = WindowsType.Windows2003;
                    }
                    else
                    {
                        Rev = WindowsType.WindowsXp;
                    }
                    break;

                case 6:
                    if (osInfo.Version.Minor == 1)
                    {
                        Rev = WindowsType.Windows7;
                    }
                    else if (osInfo.Version.Minor == 2)
                    {
                        Rev = WindowsType.Windows8;
                    }
                    break;
                }
                break;


                //Win7的版本号 6.1
                //Win8的版本号 6.2
                //Version version = Environment.OSVersion.Version;
                //if (version.Major == 6 && (version.Minor == 1 || version.Minor == 2))
                //{
                //
                //}
            }
            return(Rev);
        }
示例#9
0
    public static GameObject activedWindow;//当前激活的窗口

    /// <summary>
    /// 创建窗体
    /// </summary>
    public static void CreateWindows(string title, string message, string buttonText = "确认", UIWidget.Pivot messagePivot = UIWidget.Pivot.TopLeft, List<EventDelegate.Callback> events = null, WindowsType type = WindowsType.MessageWindow)
    {
        //创建窗体
        GameObject uiroot = GameObject.Find("UI Root");
        if (uiroot != null)
        {
            //实例化

            //选择实例化窗口
            string windowPrefab;
            switch(type)
            {
                case WindowsType.MessageWindow:
                    windowPrefab = "Windows/MessageWindow";
                    break;
                case WindowsType.WaittingWindow:
                    windowPrefab = "Windows/WaittingWindow";
                    break;
                case WindowsType.ErrorWindow:
                    windowPrefab = "Windows/ErrorWindow";
                    break;
                default:
                    windowPrefab = "Window";
                    break;
            }

            GameObject prefab = Resources.Load<GameObject>(windowPrefab);
            GameObject window = NGUITools.AddChild(uiroot, prefab);

            if (activedWindow != null)
            {
                CloseWindow();
            }
            activedWindow = window;

            //取值
            GameObject titleTextLabel = window.transform.FindChild("WindowMain/Title/TitleText").gameObject;
            GameObject messageLabel = window.transform.FindChild("WindowMain/Message").gameObject;
            GameObject confirmButton = window.transform.FindChild("WindowMain/ConfirmButton").gameObject;
            GameObject confirmButtonLabel = window.transform.FindChild("WindowMain/ConfirmButton/Label").gameObject;
            //GameObject overlay = window.transform.FindChild("Overlay").gameObject;
            GameObject closeButton = window.transform.FindChild("WindowMain/CloseButton").gameObject;

            //文本赋值
            titleTextLabel.GetComponent<UILabel>().text = title;
            messageLabel.GetComponent<UILabel>().text = message;
            messageLabel.GetComponent<UILabel>().pivot = messagePivot;
            confirmButtonLabel.GetComponent<UILabel>().text = buttonText;

            //点击事件
            if (events == null && type == WindowsType.MessageWindow)
            {
                events = new List<EventDelegate.Callback>();
                events.Add(new EventDelegate.Callback(CloseWindow));
            }
            if (events != null)
            {
                foreach (EventDelegate.Callback _event in events)
                    confirmButton.GetComponent<UIButton>().onClick.Add(new EventDelegate(_event));
            }

            //背景事件
            //UIEventListener.Get(overlay).onClick += CloseWindow;

            //关闭按钮
            UIEventListener.Get(closeButton).onClick += CloseWindow;

            //动画
            TweenScale ts = confirmButton.AddComponent<TweenScale>();
            ts.to = new Vector3(1.1f, 1.1f, 1.1f);
            ts.duration = 0.1f;
            ts.enabled = false;

            UIEventListener.Get(confirmButton).onHover += OnButtonHover;
        }
        else
        {
            LogsSystem.Instance.Print("生成窗体发生异常", LogLevel.ERROR);
        }
    }
示例#10
0
 public BackendEventWindows(string id, WindowsType windowsType, bool canceled = false, string reason = "") : base(id, EventType.Windows) { WindowsType = windowsType; Canceled = canceled; Reason = reason; }