Example #1
0
        private FVM GetCurrentViewMode()
        {
            IShellView shellView = null;

            try {
                if (0 == shellBrowser.QueryActiveShellView(out shellView))
                {
                    IFolderView folderView = shellView as IFolderView;

                    if (folderView != null)
                    {
                        FVM currentMode = 0;
                        folderView.GetCurrentViewMode(ref currentMode);

                        return(currentMode);
                    }
                }
            }
            catch {
            }
            finally {
                if (shellView != null)
                {
                    Marshal.ReleaseComObject(shellView);
                }
            }

            return(FVM.ICON);
        }
Example #2
0
        private void fvmw_ViewModeChanged(object sender, EventArgs e)
        {
            IShellView shellView = null;

            try {
                if (0 == shellBrowser.QueryActiveShellView(out shellView))
                {
                    IFolderView folderView = shellView as IFolderView;

                    if (folderView != null)
                    {
                        FVM currentMode = 0;
                        folderView.GetCurrentViewMode(ref currentMode);

                        FVM mode = fvmw.ViewMode;

                        if (currentMode != mode)
                        {
                            folderView.SetCurrentViewMode(mode);
                            UpdateButtonImage(mode);
                        }
                    }
                }
            }
            catch {
            }
            finally {
                if (shellView != null)
                {
                    Marshal.ReleaseComObject(shellView);
                }
            }
        }