Exemple #1
0
        /// <summary>
        /// Ctor: initializes main form.
        /// </summary>
        public MainForm(ICedictEngineFactory dictFact, ITextProvider tprov)
            : base(tprov)
        {
            this.tprov = tprov;

            // Initialize hanzi renderer
            // -- Scale (DPI)
            // -- Available systems fonts
            HanziRenderer.Scale = Scale;
            if (HanziRenderer.IsWinKaiAvailable())
            {
                Magic.SetZhoContentFontFamily(IdeoFamily.WinKai);
            }
            else
            {
                Magic.SetZhoContentFontFamily(IdeoFamily.ArphicKai);
            }

            // Initialize system font provider with our own
            if (SystemFontProvider.Instance as ZydeoSystemFontProvider == null)
            {
                SystemFontProvider.Instance = new ZydeoSystemFontProvider();
            }

            // Find out last window size and location from settings
            Size  size = AppSettings.WindowLogicalSize;
            Point loc  = AppSettings.WindowLoc;

            ignoredSavedSizeAndLocation = !verifySizeAndLoc(size, loc);
            // If location+size do not make sense, let system position window, and go with default size.
            if (ignoredSavedSizeAndLocation)
            {
                WinForm.StartPosition = FormStartPosition.WindowsDefaultLocation;
                LogicalSize           = Magic.WinDefaultLogicalSize;
            }
            // Otherwise, position at last location
            else
            {
                WinForm.StartPosition = FormStartPosition.Manual;
                Location    = loc;
                LogicalSize = size;
            }
            // Set (logical) minimum size
            LogicalMinimumSize = Magic.WinMinimumLogicalSize;

            Header  = tprov.GetString("WinHeader");
            lc      = new LookupControl(this, dictFact, tprov);
            stgs    = new SettingsControl(this, tprov, dictFact);
            MainTab = new ZenTab(stgs, tprov.GetString("TabMain"));
            Tabs.Add(new ZenTab(lc, tprov.GetString("TabLookup")));
        }
Exemple #2
0
        /// <summary>
        /// Ctor: initializes main form.
        /// </summary>
        public MainForm(ICedictEngineFactory dictFact, ITextProvider tprov)
            : base(tprov)
        {
            this.tprov = tprov;

            // Initialize hanzi renderer
            // -- Scale (DPI)
            // -- Available systems fonts
            HanziRenderer.Scale = Scale;
            if (HanziRenderer.IsWinKaiAvailable()) Magic.SetZhoContentFontFamily(IdeoFamily.WinKai);
            else Magic.SetZhoContentFontFamily(IdeoFamily.ArphicKai);

            // Initialize system font provider with our own
            if (SystemFontProvider.Instance as ZydeoSystemFontProvider == null)
                SystemFontProvider.Instance = new ZydeoSystemFontProvider();

            // Find out last window size and location from settings
            Size size = AppSettings.WindowLogicalSize;
            Point loc = AppSettings.WindowLoc;
            ignoredSavedSizeAndLocation = !verifySizeAndLoc(size, loc);
            // If location+size do not make sense, let system position window, and go with default size.
            if (ignoredSavedSizeAndLocation)
            {
                WinForm.StartPosition = FormStartPosition.WindowsDefaultLocation;
                LogicalSize = Magic.WinDefaultLogicalSize;
            }
            // Otherwise, position at last location
            else
            {
                WinForm.StartPosition = FormStartPosition.Manual;
                Location = loc;
                LogicalSize = size;
            }
            // Set (logical) minimum size
            LogicalMinimumSize = Magic.WinMinimumLogicalSize;

            Header = tprov.GetString("WinHeader");
            lc = new LookupControl(this, dictFact, tprov);
            stgs = new SettingsControl(this, tprov, dictFact);
            MainTab = new ZenTab(stgs, tprov.GetString("TabMain"));
            Tabs.Add(new ZenTab(lc, tprov.GetString("TabLookup")));
        }