コード例 #1
0
        public static void CheckUpdate()
        {
            try
            {
                #if __MonoCS__
                DesktopType desktopType = SysUtils.GetDesktopType();
                if (desktopType == DesktopType.Unity)
                {
                    // In Ubuntu 1604 LTS (Unity desktop), this method leads to a
                    // complete crash of the program at the level of X11,
                    // but in the same version of Ubuntu and Xfce, everything is fine
                    Logger.LogWrite("UpdateMan.CheckUpdate(): is not supported for Unity");
                    return;
                }
                #endif

                Thread worker = new Thread(WorkerMethod);
                worker.SetApartmentState(ApartmentState.STA);
                worker.IsBackground = true;
                worker.Start();
            }
            catch (Exception ex)
            {
                Logger.LogWrite("UpdateMan.CheckUpdate(): " + ex.Message);
            }
        }
コード例 #2
0
ファイル: NotifyIconEx.cs プロジェクト: ArtjomP/KeePass2.x
        public NotifyIconEx(IContainer container)
        {
            try
            {
                bool bNtf = true;
                if (NativeLib.GetPlatformID() == PlatformID.MacOSX)
                {
                    bNtf = !MonoWorkarounds.IsRequired(1574);
                }
                else
                {
                    DesktopType t = NativeLib.GetDesktopType();
                    if ((t == DesktopType.Unity) || (t == DesktopType.Pantheon))
                    {
                        bNtf = !MonoWorkarounds.IsRequired(1354);
                    }
                }

                if (bNtf)
                {
                    m_ntf = new NotifyIcon(container);
                }
            }
            catch (Exception) { Debug.Assert(false); }
        }
コード例 #3
0
 private bool ControlIDINCollection(string id, DesktopType dt)
 {
     foreach (string s in DeskTopTypeBFL.GetIDCollectionByDesktopType(dt))
     {
         if (id.Equals(s))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
        protected static string GetDefaultSansSerifFontNames(DesktopType forDesktop)
        {
            switch (forDesktop)
            {
            case DesktopType.Linux:
                return("FreeSans, Nimbus Sans L, Garuda, Utkal, Arial, Helvetica, sans-serif");

            case DesktopType.Mac:
                return("-apple-system-font, .AppleSystemUIFont, Helvetica Neue, Helvetica, Lucida Grande, Lucida Sans Unicode, Arial, sans-serif");

            default:
                return("Segoe UI, Tahoma, Arial, Helvetica, Lucida Sans Unicode, Lucida Grande, sans-serif");
            }
        }
コード例 #5
0
        protected static string GetDefaultSerifFontNames(DesktopType forDesktop)
        {
            switch (forDesktop)
            {
            case DesktopType.Linux:
                return("FreeSerif, Bitstream Vera Serif, DejaVu Serif, Likhan, Norasi, Rekha, Times New Roman, Times, serif");

            case DesktopType.Mac:
                return("Georgia, Palatino, Times New Roman, Times, serif");

            default:
                return("Times New Roman, Times, serif");
            }
        }
コード例 #6
0
        protected static string GetDefaultMonospaceFontNames(DesktopType forDesktop)
        {
            switch (Desktop.DesktopType)
            {
            case DesktopType.Linux:
                return("FreeMono, Nimbus Mono L, Courier New, Courier, monospace");

            case DesktopType.Mac:
                return("Menlo, Monaco, Courier New, Courier, monospace");

            default:
                return("Lucida Console, Courier New, Courier, monospace");
            }
        }
コード例 #7
0
ファイル: DeskTopTypeBFL.cs プロジェクト: riyuexing/rms
        public static List <string> GetIDCollectionByDesktopType(DesktopType deskType)
        {
            List <string>         list       = new List <string>();
            DeskTopTypeQueryModel queryModel = new DeskTopTypeQueryModel();

            queryModel.DeskTypeEqual = deskType.ToString("d");
            List <DeskTopTypeModel> deskTopTypeList = new DeskTopTypeBFL().GetDeskTopTypeList(queryModel);

            foreach (DeskTopTypeModel model2 in deskTopTypeList)
            {
                list.Add(model2.ControldID.ToString());
            }
            return(list);
        }
コード例 #8
0
ファイル: NativeLib.cs プロジェクト: yesde/keepass
		public static DesktopType GetDesktopType()
		{
			if(!m_tDesktop.HasValue)
			{
				DesktopType t = DesktopType.None;
				if(!IsUnix()) t = DesktopType.Windows;
				else
				{
					try
					{
						string strXdg = (Environment.GetEnvironmentVariable(
							"XDG_CURRENT_DESKTOP") ?? string.Empty).Trim();
						string strGdm = (Environment.GetEnvironmentVariable(
							"GDMSESSION") ?? string.Empty).Trim();
						StringComparison sc = StrUtil.CaseIgnoreCmp;

						if(strXdg.Equals("Unity", sc))
							t = DesktopType.Unity;
						else if(strXdg.Equals("LXDE", sc))
							t = DesktopType.Lxde;
						else if(strXdg.Equals("XFCE", sc))
							t = DesktopType.Xfce;
						else if(strXdg.Equals("MATE", sc))
							t = DesktopType.Mate;
						else if(strXdg.Equals("X-Cinnamon", sc))
							t = DesktopType.Cinnamon;
						else if(strXdg.Equals("Pantheon", sc)) // Elementary OS
							t = DesktopType.Pantheon;
						else if(strXdg.Equals("KDE", sc) || // Mint 16
							strGdm.Equals("kde-plasma", sc)) // Ubuntu 12.04
							t = DesktopType.Kde;
						else if(strXdg.Equals("GNOME", sc))
						{
							if(strGdm.Equals("cinnamon", sc)) // Mint 13
								t = DesktopType.Cinnamon;
							else t = DesktopType.Gnome;
						}
					}
					catch(Exception) { Debug.Assert(false); }
				}

				m_tDesktop = t;
			}

			return m_tDesktop.Value;
		}
コード例 #9
0
        private bool ControlIDINCollection(string id)
        {
            string      deskType = Request.QueryString["DesktopType"];
            DesktopType ddt      = DesktopType.OA;

            if (deskType.Equals(DesktopType.PM.ToString()))
            {
                ddt = DesktopType.PM;
            }
            foreach (string s in DeskTopTypeBFL.GetIDCollectionByDesktopType(ddt))
            {
                if (id.Equals(s))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #10
0
ファイル: Desktop.aspx.cs プロジェクト: riyuexing/rms
        public bool ControlInDesktop(string controlID)
        {
            string      strDeskType = Request.QueryString["DesktopType"];
            DesktopType dkTT        = DesktopType.OA;

            deskLabel.Text = "办公管理桌面";
            if (strDeskType.Equals("PM"))
            {
                dkTT           = DesktopType.PM;
                deskLabel.Text = "项目管理桌面";
            }
            List <string> listValue = DeskTopTypeBFL.GetIDCollectionByDesktopType(dkTT);

            foreach (string s in listValue)
            {
                if (s.Equals(controlID))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #11
0
ファイル: SysUtils.cs プロジェクト: hazzik/GEDKeeper
        public static DesktopType GetDesktopType()
        {
            DesktopType deskType = DesktopType.None;

            if (!IsUnix())
            {
                deskType = DesktopType.Windows;
            }
            else
            {
                try
                {
                    string strXdg = (Environment.GetEnvironmentVariable(
                                         "XDG_CURRENT_DESKTOP") ?? string.Empty).Trim();
                    string strGdm = (Environment.GetEnvironmentVariable(
                                         "GDMSESSION") ?? string.Empty).Trim();
                    StringComparison sc = StringComparison.OrdinalIgnoreCase;

                    if (strXdg.Equals("Unity", sc))
                    {
                        deskType = DesktopType.Unity;
                    }
                    else if (strXdg.Equals("LXDE", sc))
                    {
                        deskType = DesktopType.Lxde;
                    }
                    else if (strXdg.Equals("XFCE", sc))
                    {
                        deskType = DesktopType.Xfce;
                    }
                    else if (strXdg.Equals("MATE", sc))
                    {
                        deskType = DesktopType.Mate;
                    }
                    else if (strXdg.Equals("X-Cinnamon", sc))
                    {
                        deskType = DesktopType.Cinnamon;
                    }
                    else if (strXdg.Equals("Pantheon", sc)) // Elementary OS
                    {
                        deskType = DesktopType.Pantheon;
                    }
                    else if (strXdg.Equals("KDE", sc) ||      // Mint 16
                             strGdm.Equals("kde-plasma", sc)) // Ubuntu 12.04
                    {
                        deskType = DesktopType.Kde;
                    }
                    else if (strXdg.Equals("GNOME", sc))
                    {
                        if (strGdm.Equals("cinnamon", sc)) // Mint 13
                        {
                            deskType = DesktopType.Cinnamon;
                        }
                        else
                        {
                            deskType = DesktopType.Gnome;
                        }
                    }
                } catch (Exception) {
                    Debug.Assert(false);
                }
            }

            return(deskType);
        }