Inheritance: System.Windows.Controls.Control
        public void Initialize()
        {
            createButton();

            hostControl = KCVUIHelper.KCVWindow.FindVisualChildren<KanColleHost>().First();            
            contentContainer = hostControl.Parent as Grid;
            pluginControl = KCVUIHelper.KCVContent;

            hostControl.ZoomFactor = this.BrowserZoomFactor / 100.0;
            switchLayout(CurrentLayout);
        }
Example #2
0
        private static void ApplyZoomFactor(KanColleHost target, int zoomFactor)
        {
            if (!target.firstLoaded)
            {
                return;
            }

            if (zoomFactor < 10 || zoomFactor > 1000)
            {
                StatusService.Current.Notify(string.Format(Properties.Resources.ZoomAction_OutOfRange, zoomFactor));
                return;
            }

            try
            {
                var provider = target.WebBrowser.Document as IServiceProvider;
                if (provider == null)
                {
                    return;
                }

                object ppvObject;
                provider.QueryService(typeof(IWebBrowserApp).GUID, typeof(IWebBrowser2).GUID, out ppvObject);
                var webBrowser = ppvObject as IWebBrowser2;
                if (webBrowser == null)
                {
                    return;
                }

                object pvaIn = zoomFactor;
                webBrowser.ExecWB(OLECMDID.OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, ref pvaIn);
            }
            catch (Exception) when(Application.Instance.State == ApplicationState.Startup)
            {
                // about:blank だから仕方ない
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                StatusService.Current.Notify(string.Format(Properties.Resources.ZoomAction_ZoomFailed, ex.Message));
            }
        }
Example #3
0
		private static void ApplyZoomFactor(KanColleHost target, int zoomFactor)
		{
			if (!target.firstLoaded) return;

			if (zoomFactor < 10 || zoomFactor > 1000)
			{
				StatusService.Current.Notify(string.Format(Properties.Resources.ZoomAction_OutOfRange, zoomFactor));
				return;
			}

			try
			{
				var provider = target.WebBrowser.Document as IServiceProvider;
				if (provider == null) return;

				object ppvObject;
				provider.QueryService(typeof(IWebBrowserApp).GUID, typeof(IWebBrowser2).GUID, out ppvObject);
				var webBrowser = ppvObject as IWebBrowser2;
				if (webBrowser == null) return;

				object pvaIn = zoomFactor;
				webBrowser.ExecWB(OLECMDID.OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, ref pvaIn);
			}
			catch (Exception) when (Application.Instance.State == ApplicationState.Startup)
			{
				// about:blank だから仕方ない
			}
			catch (Exception ex)
			{
				Debug.WriteLine(ex);
				StatusService.Current.Notify(string.Format(Properties.Resources.ZoomAction_ZoomFailed, ex.Message));
			}
		}