Example #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public MainForm()
        {
            try
            {
                m_nTaskbarButtonMessage = NativeMethods.RegisterWindowMessage(
                    "TaskbarButtonCreated");
                m_bTaskbarButtonMessage = (m_nTaskbarButtonMessage != 0);
            }
            catch(Exception)
            {
                m_nTaskbarButtonMessage = 0x1E8F46A7; // Unlikely to occur
                m_bTaskbarButtonMessage = false;
            }

            string strIso6391 = Program.Translation.Properties.Iso6391Code;
            if(strIso6391.Length > 0)
            {
                try
                {
                    CultureInfo ci = CultureInfo.CreateSpecificCulture(strIso6391);
                    Application.CurrentCulture = ci;
                    Thread.CurrentThread.CurrentCulture = ci;
                    Thread.CurrentThread.CurrentUICulture = ci;
                    Properties.Resources.Culture = ci;
                }
                catch(Exception) { Debug.Assert(false); }
            }

            UIUtil.Initialize(false);

            InitializeComponent();
            Program.Translation.ApplyTo(this);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_menuMain", m_menuMain.Items);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_ctxPwList", m_ctxPwList.Items);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_ctxGroupList", m_ctxGroupList.Items);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_ctxTray", m_ctxTray.Items);

            m_asyncListUpdate = new AsyncPwListUpdate(m_lvEntries);

            m_splitHorizontal.InitEx(this.Controls, m_menuMain);
            m_splitVertical.InitEx(this.Controls, m_menuMain);

            AssignMenuShortcuts();
            AssignMenuShortcutsOpt();

            if(NativeLib.IsUnix())
            {
                // Workaround for tab bar height bug in Mono
                // https://sourceforge.net/projects/keepass/forums/forum/329221/topic/4519750
                m_tabMain.Height += 3;
            }
        }
Example #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public MainForm()
        {
            try
            {
                m_nTaskbarButtonMessage = NativeMethods.RegisterWindowMessage(
                    "TaskbarButtonCreated");
                m_bTaskbarButtonMessage = (m_nTaskbarButtonMessage != 0);
            }
            catch(Exception)
            {
                m_nTaskbarButtonMessage = 0x1E8F46A7; // Unlikely to occur
                m_bTaskbarButtonMessage = false;
            }

            string strIso6391 = Program.Translation.Properties.Iso6391Code;
            if(strIso6391.Length > 0)
            {
                try
                {
                    CultureInfo ci = CultureInfo.CreateSpecificCulture(strIso6391);
                    Application.CurrentCulture = ci;
                    Thread.CurrentThread.CurrentCulture = ci;
                    Thread.CurrentThread.CurrentUICulture = ci;
                    Properties.Resources.Culture = ci;
                }
                catch(Exception) { Debug.Assert(false); }
            }

            UIUtil.Initialize(false);

            InitializeComponent();
            Program.Translation.ApplyTo(this);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_menuMain", m_menuMain.Items);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_ctxPwList", m_ctxPwList.Items);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_ctxGroupList", m_ctxGroupList.Items);
            Program.Translation.ApplyTo("KeePass.Forms.MainForm.m_ctxTray", m_ctxTray.Items);

            m_asyncListUpdate = new AsyncPwListUpdate(m_lvEntries);

            m_splitHorizontal.InitEx(this.Controls, m_menuMain);
            m_splitVertical.InitEx(this.Controls, m_menuMain);

            AssignMenuShortcuts();

            if(MonoWorkarounds.IsRequired(891029)) m_tabMain.Height += 5;
        }