Beispiel #1
0
        private void OpenInInternalBrowser(
            WebEntryInfo webEntryInfo,
            IContentContainer contentContainer,
            object selectedObject,
            string webEntityInfoPropertyName = null)
        {
            string             url = webEntryInfo != null ? webEntryInfo.Url : null;
            BrowserPrivateType browserPrivateType = webEntryInfo.BrowserPrivateType;
            ViewType           viewType           = webEntryInfo.RecоmmendedViewType;

            bool isFile = false;
            bool isUrl  = false;

            FileUtils.IsFilePath(url, out isFile, out isUrl);
            if (isFile)
            {
                if (viewType == ViewType.NONE)
                {
                    viewType = GetViewTypeByFilePath(url);
                }
            }
            else
            {
                viewType = ViewType.CefBrowser;
            }

            BaseViewWindow itemViewWindow = AppManager.Instance.CreateContent(contentContainer, AppManager.Instance.DefaultViewWindowType,
                                                                              new Dictionary <string, object>()
            {
                { "Item", selectedObject },
                { "WebEntityInfoPropertyName", webEntityInfoPropertyName },
                { "BrowserPrivateType", browserPrivateType }
            }) as BaseViewWindow;

            itemViewWindow.ViewType     = viewType;
            itemViewWindow.FileFullPath = url;
            itemViewWindow.ProcessView();
        }
Beispiel #2
0
        private void CreateOpenInInternalBrowserContextMenu(List <ToolStripItem> subs2,
                                                            ViewType viewType,
                                                            ViewType recоmmendedViewType,
                                                            BrowserPrivateType browserPrivateType,
                                                            string url,
                                                            WebEntryInfo webEntryInfo,
                                                            IContentContainer contentContainer,
                                                            object selectedObject,
                                                            string webEntityInfoPropertyName = null)
        {
            ToolStripMenuItem menuItem = new ToolStripMenuItem();

            StringBuilder text = new StringBuilder();

            text.Append(WebAccountLibRes.Open_in_ + " ");
            if (viewType == ViewType.Awesomium)
            {
                text.Append(WebAccountLibRes.Awesomium);
            }
            else if (viewType == ViewType.CefBrowser)
            {
                text.Append(WebAccountLibRes.Chromium_Embedded);
            }
            else if (viewType == ViewType.IE)
            {
                text.Append(WebAccountLibRes.IE);
            }
            else if (viewType == ViewType.Simple)
            {
                text.Append(WebAccountLibRes.Simple_editor);
            }
            else if (viewType == ViewType.WORD)
            {
                text.Append(WebAccountLibRes.MS_Word);
            }
            if (viewType == ViewType.CefBrowser)
            {
                if (browserPrivateType == BrowserPrivateType.COMMON_CACHE)
                {
                    text.Append("");
                }
                else if (browserPrivateType == BrowserPrivateType.PERSONAL_IN_MEMORY_CACHE)
                {
                    text.Append(WebAccountLibRes.__private_in_memory_cache_);
                }
                else if (browserPrivateType == BrowserPrivateType.PERSONAL_OLD_DISK_CACHE)
                {
                    text.Append(WebAccountLibRes.__private_persistent_cache_);
                }
                else if (browserPrivateType == BrowserPrivateType.PERSONAL_NEW_DISK_CACHE)
                {
                    text.Append(WebAccountLibRes.__private_persistent_cache__cleared__);
                }
            }
            menuItem.Text   = text.ToString();
            menuItem.Click += (s, em) =>
            {
                try
                {
                    if (CheckLevel(webEntryInfo) == false)
                    {
                        return;
                    }

                    BaseViewWindow itemViewWindow = AppManager.Instance.CreateContent(contentContainer, AppManager.Instance.DefaultViewWindowType,
                                                                                      new Dictionary <string, object>()
                    {
                        { "Item", selectedObject },
                        { "WebEntityInfoPropertyName", webEntityInfoPropertyName },
                        { "BrowserPrivateType", browserPrivateType }
                    }) as BaseViewWindow;
                    itemViewWindow.ViewType     = viewType;
                    itemViewWindow.FileFullPath = url;
                    itemViewWindow.ProcessView();
                }
                catch (Exception ex)
                {
                    Log.ShowError(ex);
                }
            };
            subs2.Add(menuItem);
        }