public static extern ERROR SHCreateDirectory(IShellView hwnd, string pszPath);
Example #2
0
        public DescriptionsView(
            ILoggerFacade logger,
            IEventAggregator eventAggregator,
            IUnityContainer container,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(DescriptionsViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsViewModel viewModel)
        {
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;
            m_Container       = container;
            m_ShellView       = shellView;
            m_Session         = session;

            m_ViewModel           = viewModel;
            m_ViewModel.ShellView = m_ShellView;

            m_Logger.Log("DescriptionsView.ctor", Category.Debug, Priority.Medium);

            DataContext = m_ViewModel;
            InitializeComponent();
        }
Example #3
0
        public NavigationPanePlugin(
            ILoggerFacade logger,
            IRegionManager regionManager,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(NavigationPane), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            NavigationPane pane)
        {
            m_Logger        = logger;
            m_RegionManager = regionManager;

            m_UrakawaSession = session;
            m_ShellView      = shellView;
            m_NavPane        = pane;

            m_RegionManager.RegisterNamedViewWithRegion(RegionNames.NavigationPane,
                                                        new PreferredPositionNamedView {
                m_viewInstance = m_NavPane, m_viewName = @"ViewOf_" + RegionNames.NavigationPane
            });

            //m_RegionManager.RegisterViewWithRegion(RegionNames.NavigationPane, typeof(NavigationPane));

            //IRegion targetRegion = m_RegionManager.Regions[RegionNames.NavigationPane];
            //targetRegion.Add(m_NavPane);
            //targetRegion.Activate(m_NavPane);

            //m_Logger.Log(@"Navigation pane plugin initializing...", Category.Debug, Priority.Medium);
        }
Example #4
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            IShellView shellView = Window.Current.Content as IShellView;

            // create shell if it has not been initialized yet
            if (shellView == null)
            {
                shellView = CreateShell();
                Frame rootFrame = shellView.RootFrame;
                NavigationService.AttachToFrame(rootFrame);

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                Window.Current.Content = shellView as UIElement;
            }

            // navigate frame to start page
            //if (shellView.RootFrame.Content == null)
            //{
            //    // When the navigation stack isn't restored navigate to the first page,
            //    // configuring the new page by passing required information as a navigation
            //    // parameter
            //    //if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
            //    if (!NavigationService.Navigate(CreateShell(), "/?TestProperty=ololoItWorks!!!!!!"))//args.Arguments))
            //    {
            //        throw new Exception("Failed to create initial page");
            //    }
            //}


            Window.Current.Activate();
        }
        public void WillInitializeAllModuleLoadersOnStart()
        {
            MockRepository            mocks       = new MockRepository();
            IModuleLoader             mockLoader1 = mocks.DynamicMock <IModuleLoader>();
            IModuleLoader             mockLoader2 = mocks.DynamicMock <IModuleLoader>();
            IModuleLoader             mockLoader3 = mocks.DynamicMock <IModuleLoader>();
            IShellView                stubShell   = mocks.Stub <IShellView>();
            DefaultApplicationContext context     = mocks.PartialMock <DefaultApplicationContext>(
                stubShell, new IModuleLoader[] { mockLoader1, mockLoader2, mockLoader3 });

            using (mocks.Record())
            {
                //we may have order dependnecies, let us verify
                //that it does this in order
                using (mocks.Ordered())
                {
                    mockLoader1.Initialize(context, stubShell);
                    mockLoader2.Initialize(context, stubShell);
                    mockLoader3.Initialize(context, stubShell);
                }

                //force context to ignore these calls
                Expect.Call(context.GetShellAsForm()).Return(null).Repeat.Once();
                Expect.Call(delegate { context.RunForm(null); }).Repeat.Once();
            }

            using (mocks.Playback())
            {
                context.Start();
            }
        }
 public void before()
 {
     serviceLocator = MockRepository.GenerateStub<IServiceLocator>();
     shellView = MockRepository.GenerateMock<IShellView>();
     menuController = MockRepository.GenerateMock<IMenuController>();
     serviceLocator.Stub(x => x.GetInstance<IMenuController>()).Return(menuController);
 }
        public DescriptionsPlugin(
            ILoggerFacade logger,
            IUnityContainer container,
            IEventAggregator eventAggregator,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(IDescriptionsView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsView view
            )
        {
            m_Logger           = logger;
            m_Container        = container;
            m_ShellView        = shellView;
            m_DescriptionsView = view;

            m_UrakawaSession  = session;
            m_EventAggregator = eventAggregator;

            CommandShowDescriptions = new RichDelegateCommand(
                Tobi_Plugin_Descriptions_Lang.CmdEditDescriptions_ShortDesc,
                Tobi_Plugin_Descriptions_Lang.CmdEditDescriptions_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon(@"edit-find-replace"),
                ShowDialog,
                CanShowDialog,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_EditDescriptions));

            m_ShellView.RegisterRichCommand(CommandShowDescriptions);

            //m_Logger.Log(@"DescriptionsPlugin init", Category.Debug, Priority.Medium);
        }
Example #8
0
        public MetadataPanePlugin(
            ILoggerFacade logger,
            IEventAggregator eventAggregator,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(IMetadataPaneView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            MetadataPaneView view)
        {
            m_Logger           = logger;
            m_UrakawaSession   = session;
            m_ShellView        = shellView;
            m_MetadataPaneView = view;
            m_EventAggregator  = eventAggregator;

            CommandShowMetadataPane = new RichDelegateCommand(
                Tobi_Plugin_MetadataPane_Lang.CmdShowMetadata_ShortDesc,
                Tobi_Plugin_MetadataPane_Lang.CmdShowMetadata_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeGionIcon(@"Gion_text-x-readme"),
                ShowDialog,
                CanShowDialog,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Metadata_Edit));

            m_ShellView.RegisterRichCommand(CommandShowMetadataPane);

            m_EventAggregator.GetEvent <LaunchMetadataEditorEvent>().Subscribe(OnLaunchMetadataEditor, LaunchMetadataEditorEvent.THREAD_OPTION);


            //m_Logger.Log(@"Metadata plugin initializing...", Category.Debug, Priority.Medium);
        }
        public MetadataPaneViewModel(
            IEventAggregator eventAggregator,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            ILoggerFacade logger,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(MetadataValidator), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition = false)]
            MetadataValidator validator
            )
        {
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;

            m_Validator      = validator;
            m_UrakawaSession = session;
            m_ShellView      = shellView;

            m_MetadataCollection = null;

            ValidationItems = new ObservableCollection <ValidationItem>();

            if (m_Validator != null)
            {
                m_Validator.ValidatorStateRefreshed += OnValidatorStateRefreshed;
                resetValidationItems(m_Validator);
            }

            m_EventAggregator.GetEvent <ProjectLoadedEvent>().Subscribe(OnProjectLoaded, ProjectLoadedEvent.THREAD_OPTION);
            m_EventAggregator.GetEvent <ProjectUnLoadedEvent>().Subscribe(OnProjectUnLoaded, ProjectUnLoadedEvent.THREAD_OPTION);
        }
Example #10
0
        public AudioPanePlugin(
            ILoggerFacade logger,
            IRegionManager regionManager,
            [Import(typeof(IAudioPaneView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            AudioPaneView audioPaneView,
            [Import(typeof(AudioPaneViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            AudioPaneViewModel audioPaneViewModel,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView)
        {
            m_Logger        = logger;
            m_RegionManager = regionManager;

            m_AudioPaneView      = audioPaneView;
            m_AudioPaneViewModel = audioPaneViewModel;

            m_ShellView = shellView;

            m_RegionManager.RegisterNamedViewWithRegion(RegionNames.AudioPane,
                                                        new PreferredPositionNamedView {
                m_viewInstance = m_AudioPaneView, m_viewName = @"ViewOf_" + RegionNames.AudioPane
            });

            //m_RegionManager.RegisterViewWithRegion(RegionNames.AudioPane, typeof(IAudioPaneView));

            //IRegion targetRegion = m_RegionManager.Regions[RegionNames.AudioPane];
            //targetRegion.Add(m_AudioPaneView);
            //targetRegion.Activate(m_AudioPaneView);

            //m_Logger.Log(@"AudioPanePlugin is initializing...", Category.Debug, Priority.Medium);
        }
Example #11
0
        public SettingsView(
            ILoggerFacade logger,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(ISettingsAggregator), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition = false)]
            ISettingsAggregator settingsAggregator)
        {
            m_PropertyChangeHandler = new PropertyChangedNotifyBase();
            m_PropertyChangeHandler.InitializeDependentProperties(this);

            m_Logger    = logger;
            m_ShellView = shellView;
            m_Session   = session;

            m_SettingsAggregator = settingsAggregator;

            resetList();

            InitializeComponent();

            intializeCommands();

            // NEEDS to be after InitializeComponent() in order for the DataContext bridge to work.
            DataContext = this;
        }
Example #12
0
        public static IntPtr ShellGetPath(IShellBrowser shellBrowser)
        {
            IShellView      ppshv = null;
            IPersistFolder2 ppv   = null;

            try {
                if (shellBrowser.QueryActiveShellView(out ppshv) == 0)
                {
                    Guid        riid  = ExplorerGUIDs.IID_IPersistFolder2;
                    IFolderView view2 = (IFolderView)ppshv;
                    if (view2.GetFolder(ref riid, out ppv) == 0)
                    {
                        IntPtr ptr;
                        ppv.GetCurFolder(out ptr);
                        return(ptr);
                    }
                }
            }
            catch {
            }
            finally {
                if (ppshv != null)
                {
                    Marshal.ReleaseComObject(ppshv);
                }
                if (ppv != null)
                {
                    Marshal.ReleaseComObject(ppv);
                }
            }
            return(IntPtr.Zero);
        }
Example #13
0
        public void Run()
        {
            System.Windows.Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var splash = new SplashScreenManager();

            splash.Show();

            var sc = new ServiceCollection();

            sc.AddMqExplorerPlusCoreServices();
            AddDependencies(sc);
            var sp = sc.BuildServiceProvider();

            MainController = sp.GetRequiredService <IApplicationController>();
            IShellView shell = MainController.Run();

            if (shell != null && shell is ShellWindow)
            {
                System.Windows.Application.Current.MainWindow   = (ShellWindow)shell;
                System.Windows.Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
                System.Windows.Application.Current.MainWindow.Show();
                splash.Close();
                System.Windows.Application.Current.MainWindow.Activate();
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
Example #14
0
        public ShellViewModel(IShellView window, IApplicationController appController)
            : base(window, appController)
        {
            Title = ApplicationInfo.ProductName;

            _settings = App.UserSettings;

            WeakEventManager <UserSettings, EventArgs>
            .AddHandler(_settings, "OnSettingsChanged", _settings_OnSettingsChanged);


            WeakEventManager <IViewService, EventArgs>
            .AddHandler(App.ViewService, "ModalOpening", Modal_Opening);

            WeakEventManager <IViewService, EventArgs>
            .AddHandler(App.ViewService, "ModalClosing", Modal_Closing);

            WeakEventManager <IViewService, CountEventArgs>
            .AddHandler(App.ViewService, "DocumentsCountChanged", Documents_CountChanged);

            _welcomeContent = App.GetViewModel <WelcomeViewModel>();
            _mainContent    = App.GetViewModel <MainViewModel>();

            Content = _welcomeContent;
        }
Example #15
0
        public KeyboardShortcuts(IShellView shellView)
        {
            ShellView   = shellView;
            DataContext = ShellView;

            InitializeComponent();
        }
        public IconsPreviewDebug(IShellView shellView)
        {
            ShellView   = shellView;
            DataContext = ShellView;

            InitializeComponent();
        }
        /// <summary>Initializes a new instance of the <see cref="ShellViewPresenter"/> class.</summary>
        /// <param name="shell">The shell.</param>
        /// <param name="msgBoxService">The msg Box Service.</param>
        /// <param name="fileBrowserService">The file Browser Service.</param>
        /// <param name="eventAggregator">The event Aggregator.</param>
        /// <param name="systemInformationService">The system Information Service.</param>
        public ShellViewPresenter(
            IShellView shell, 
            IMessageBoxService msgBoxService, 
            IFileBrowserService fileBrowserService, 
            IEventAggregator eventAggregator, 
            ISystemInformationService systemInformationService)
        {
            // Wire up our services
            this.msgBoxService = msgBoxService;
            this.fileBrowserService = fileBrowserService;
            this.eventAggregator = eventAggregator;
            this.systemInformationService = systemInformationService;

            // Wire up our view
            this.view = shell;

            // Wire up view our events
            shell.FormClosed += this.ViewOnFormClosed;
            shell.Load += this.ViewOnLoad;
            shell.KeyUp += this.ViewOnKeyUp;
            shell.HelpRequested += this.ViewOnHelpRequested;

            // WindowHandle high contrast
            if (!this.systemInformationService.IsHighContrastColourScheme)
            {
                shell.BackColor = Color.White;
            }
        }
        HResult ICommDlgBrowser.OnStateChange(IShellView ppshv, CDBOSC uChange)
        {
            if (uChange == CDBOSC.CDBOSC_SELCHANGE)
            {
                if (t.Enabled)
                {
                    t.Stop();
                    t.Start();
                }
                else
                {
                    t.Start();
                }
            }
            else if (uChange == CDBOSC.CDBOSC_SETFOCUS)
            {
                //m_ShellView.OnGotFocus();
            }
            else if (uChange == CDBOSC.CDBOSC_KILLFOCUS)
            {
                //m_ShellView.OnLostFocus();
            }

            return(HResult.S_OK);
        }
        /// <summary>Initializes a new instance of the <see cref="ShellViewPresenter"/> class.</summary>
        /// <param name="shell">The shell.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="msgBoxService">The msg Box Service.</param>
        /// <param name="systemInformationService">The system Information Service.</param>
        public ShellViewPresenter(
            IShellView shell,
            IEventAggregator eventAggregator,
            IMessageBoxService msgBoxService,
            ISystemInformationService systemInformationService)
        {
            this.eventAggregator = eventAggregator;
            this.msgBoxService   = msgBoxService;

            this.systemInformationService = systemInformationService;

            // Wire up our view
            this.view = shell;

            // Wire up view our events
            shell.FormClosed    += this.ViewOnFormClosed;
            shell.Load          += this.ViewOnLoad;
            shell.KeyUp         += this.ViewOnKeyUp;
            shell.HelpRequested += this.ViewOnHelpRequested;

            // WindowHandle high contrast
            if (!this.systemInformationService.IsHighContrastColourScheme)
            {
                shell.BackColor = Color.White;
            }
        }
Example #20
0
 public ApplicationController(IShellView shellView, IServiceLocator serviceLocator)
 {
     if (shellView == null) throw new ArgumentNullException("shellView");
     if (serviceLocator == null) throw new ArgumentNullException("serviceLocator");
     this.shellView = shellView;
     this.serviceLocator = serviceLocator;
 }
        public void Run()
        {
            System.Windows.Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var splash = new SplashScreenManager();

            splash.Show();

            InitMef();

            MainController = CompositionHost.GetInstance <IApplicationController>();
            IShellView shell = MainController.Run();

            if (shell != null && shell is ShellWindow)
            {
                System.Windows.Application.Current.MainWindow   = (ShellWindow)shell;
                System.Windows.Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
                System.Windows.Application.Current.MainWindow.Show();
                splash.Close();
                System.Windows.Application.Current.MainWindow.Activate();
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
Example #22
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);
                }
            }
        }
        internal void ConnectToView(IShellView psv)
        {
            DisconnectFromView();

            HResult hr = psv.GetItemObject(
                ShellViewGetItemObject.Background,
                ref IID_IDispatch,
                out viewDispatch);

            if (hr == HResult.Ok)
            {
                hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint(
                    this,
                    ref IID_DShellFolderViewEvents,
                    true,
                    viewDispatch,
                    ref viewConnectionPointCookie,
                    ref nullPtr);

                if (hr != HResult.Ok)
                {
                    Marshal.ReleaseComObject(viewDispatch);
                }
            }
        }
        internal void ConnectToView( IShellView psv )
        {
            DisconnectFromView( );

            HRESULT hr = psv.GetItemObject(
                SVGIO.SVGIO_BACKGROUND,
                ref IID_IDispatch,
                out viewDispatch );

            if( hr == HRESULT.S_OK )
            {
                hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint(
                    this,
                    ref IID_DShellFolderViewEvents,
                    true,
                    viewDispatch,
                    ref viewConnectionPointCookie,
                    ref nullPtr );

                if( hr != HRESULT.S_OK )
                {
                    Marshal.ReleaseComObject( viewDispatch );
                }
            }
        }
Example #25
0
        public DescriptionsNavigationView(
            IEventAggregator eventAggregator,
            ILoggerFacade logger,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession urakawaSession,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(DescriptionsNavigationViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsNavigationViewModel viewModel,
            [Import(typeof(IDescriptionsView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsView view
            )
        {
            m_UrakawaSession  = urakawaSession;
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;

            m_ShellView = shellView;
            ViewModel   = viewModel;
            DataContext = ViewModel;

            m_DescriptionsView = view;

            InitializeComponent();
            ViewModel.SetView(this);
        }
        // From a shell view object gets its automation interface and from that gets the shell application object that implements
        // IShellDispatch2 and related interfaces.
        private static IShellDispatch2 GetShellDispatchFromView(IShellView psv)
        {
            var io    = psv.GetItemObject(SVGIO.SVGIO_BACKGROUND, typeof(IDispatch).GUID);
            var psfvd = (IShellFolderViewDual)io;

            return((IShellDispatch2)psfvd.Application);
        }
Example #27
0
        internal void ConnectToView(IShellView shellView)
        {
            Contract.Requires <ArgumentNullException>(shellView != null);

            DisconnectFromView();

            var hr = shellView.GetItemObject(SVGIO.SVGIO_BACKGROUND,
                                             ref this.IID_IDispatch, out this.viewDispatch);

            if (HRESULT.Failed(hr))
            {
                return;
            }

            var ptr = IntPtr.Zero;

            hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint(this,
                                                                       ref this.IID_DShellFolderViewEvents,
                                                                       true,
                                                                       this.viewDispatch,
                                                                       ref this.viewConnectionPointCookie,
                                                                       ref ptr);
            if (HRESULT.Failed(hr))
            {
                Marshal.ReleaseComObject(this.viewDispatch);
                this.viewDispatch = null;
            }
        }
Example #28
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 #29
0
        public SettingsPlugin(
            ILoggerFacade logger,
            IUnityContainer container,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            //[Import(typeof(SettingsView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            //SettingsView view,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(ISettingsAggregator), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition = false)]
            ISettingsAggregator settingsAggregator)
        {
            m_Logger    = logger;
            m_Container = container;
            m_ShellView = shellView;

            //m_SettingsView = view;
            m_UrakawaSession = session;

            m_SettingsAggregator = settingsAggregator;

            CommandShowSettings = new RichDelegateCommand(
                Tobi_Plugin_Settings_Lang.Cmd_ApplicationPref,
                Tobi_Plugin_Settings_Lang.Cmd_DisplayEditor,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon(@"preferences-system"),
                ShowDialog,
                CanShowDialog,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_EditPreferences));

            m_ShellView.RegisterRichCommand(CommandShowSettings);

            //m_Logger.Log(@"SettingsPlugin init", Category.Debug, Priority.Medium);
        }
        internal void ConnectToView(IShellView psv)
        {
            DisconnectFromView();

            HResult hr = psv.GetItemObject(
                ShellViewGetItemObject.Background,
                ref IID_IDispatch,
                out viewDispatch);

            if (hr == HResult.Ok)
            {
                hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint(
                    this,
                    ref IID_DShellFolderViewEvents,
                    true,
                    viewDispatch,
                    ref viewConnectionPointCookie,
                    ref nullPtr);

                if (hr != HResult.Ok)
                {
                    Marshal.ReleaseComObject(viewDispatch);
                }
            }
        }
Example #31
0
        public DocumentPanePlugin(
            ILoggerFacade logger,
            IRegionManager regionManager,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(DocumentPaneView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DocumentPaneView docView)
        {
            m_Logger        = logger;
            m_RegionManager = regionManager;

            m_UrakawaSession = session;
            m_ShellView      = shellView;
            m_DocView        = docView;

            m_RegionManager.RegisterNamedViewWithRegion(RegionNames.DocumentPane,
                                                        new PreferredPositionNamedView {
                m_viewInstance = m_DocView, m_viewName = VIEW_NAME
            });

            //m_RegionManager.RegisterViewWithRegion(RegionNames.DocumentPane, typeof(DocumentPaneView));

            //IRegion targetRegion = m_RegionManager.Regions[RegionNames.DocumentPane];
            //targetRegion.Add(m_DocView);
            //targetRegion.Activate(m_DocView);

            //m_Logger.Log(@"Document pane plugin initializing...", Category.Debug, Priority.Medium);
        }
Example #32
0
        internal void ConnectToView(IShellView psv)
        {
            DisconnectFromView( );

            HRESULT hr = psv.GetItemObject(
                SVGIO.SVGIO_BACKGROUND,
                ref IID_IDispatch,
                out viewDispatch);

            if (hr == HRESULT.S_OK)
            {
                hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint(
                    this,
                    ref IID_DShellFolderViewEvents,
                    true,
                    viewDispatch,
                    ref viewConnectionPointCookie,
                    ref nullPtr);

                if (hr != HRESULT.S_OK)
                {
                    Marshal.ReleaseComObject(viewDispatch);
                }
            }
        }
Example #33
0
 HRESULT ICommDlgBrowser3.OnStateChange(IShellView ppshv, CDBOSC uChange)
 {
     if (uChange == CDBOSC.CDBOSC_SELCHANGE)
     {
         _OnSelChange();
     }
     return(HRESULT.S_OK);
 }
Example #34
0
        public ShellViewModel(IShellView view, IEventAggregator eventAggregator)
        {
            View             = view;
            View.DataContext = this;

            ExitCommand = new DelegateCommand(() =>
                                              eventAggregator.GetEvent <ExitApplicationEvent>().Publish(null));
        }
        // The below methods can be called into, but marshalling the response causes an exception to be
        // thrown from unmanaged code.  At this time, I decline calls requesting the ICommDlgBrowser2
        // interface.  This is logged as a bug, but moved to less of a priority, as it only affects being
        // able to change the default action text for remapping the default action.

        HResult ICommDlgBrowser3.GetDefaultMenuText(IShellView shellView, IntPtr text, int cchMax)
        {
            return(HResult.False);
            //return HResult.Ok;
            //OK if new
            //False if default
            //other if error
        }
		public DefaultApplicationContext(
			IShellView shell,
			IModuleLoader[] loaders
			)
		{
			this.shell = shell;
			this.loaders = loaders;
		}
Example #37
0
        protected override DependencyObject CreateShell()
        {
            IShellView v = Container.Resolve <IShellView>();

            v.ViewModel = Container.Resolve <IShellViewViewModel>();

            return(v as System.Windows.DependencyObject);
        }
 public void before_each()
 {
     serviceLocator = new StructureMapServiceLocator();
     shellView = MockRepository.GenerateStub<IShellView>();
     logSourcePresenter = MockRepository.GenerateMock<ILogSourcePresenter>();
     logProvider = MockRepository.GenerateStub<ILogProvider>();
     ObjectFactory.Initialize(
         x => x.ForRequestedType<ILogSourcePresenter>().TheDefault.IsThis(logSourcePresenter));
 }
Example #39
0
 public ShellViewModel(IShellView view, CompositionContainer compositionContainer, IEventAggregator eventAggregator, Lazy<IShellService> shellService)
 {
     View = view;
     View.ViewModel = this;
     ShellContainer = compositionContainer;
     EventAggregator = eventAggregator;
     ShellService = shellService;
     LogoutCommand = new CommandHandler<object, object>(LogoutCommandAction);
     _tabCollection = new Lazy<OptimizedObservableCollection<IViewModel>>();
 }
 public ShellController(
     IShellViewModel shellViewModel,
     IShellView shellView,
     IMainController mainController)
 {
     _shellViewModel = shellViewModel;
     _shellView = shellView;
     _mainController = mainController;
     _shellView.ViewModel = _shellViewModel;
 }
Example #41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellPresenter"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="shell">The shell.</param>
        public ShellPresenter(IUnityContainer container, IShellView shell)
        {
            this.container = container;
            Shell = shell;
            Shell.Model = this.container.Resolve<ShellPresenterModel>();
            Shell.ShowReports += new System.EventHandler<System.EventArgs>(Shell_ShowReports);
            Shell.LoadInquiry += new System.EventHandler<DataEventArgs<string>>(Shell_LoadInquiry);

            //Menu = menu;
            //Menu.Model = this.container.Resolve<MainMenuPresenterModel>();
            //Menu.OpenModule += new EventHandler<DataEventArgs<ModuleRegion>>(this.OnOpenModule);

            window = new InternalWindow();

        }
Example #42
0
        public DialogHost(IShellView shellView, Dialog content)
            : this()
        {
            _content = content;
            Width = shellView.Window.Width;
            Height = shellView.Window.Height;

            Left = shellView.Window.Left;
            Top = shellView.Window.Top;

            _contentHost.Content = content;

            DataContext = this;

            content.CloseResult.Subscribe(result => DialogResult = result);
        }
        public ShellPresenter(IShellView view)
        {
            View = view;

        }
 ShellViewModel( IShellService shellService, IShellView view )
 {
     view_ = view;
     shellService_ = shellService;
 }
Example #45
0
 public ShellPresenter(IShellView view)
 {
     this._view = view;
 }
		public void Initialize(IApplicationContext context, IShellView shell)
		{
			shell.AddMenuItems(menuItemDatas);
		}
 public ChildViewService(IShellView shellView)
 {
     _shellView = shellView;
 }
 private static extern int GetColumnInfobyPK(IShellView view, bool isAll, PROPERTYKEY pk, out CM_COLUMNINFO res);
        public Collumns[] AvailableColumns(IShellView SHView, bool All)
        {

            Guid iid = new Guid(ExplorerBrowserIIDGuid.IColumnManager);
            IntPtr view = IntPtr.Zero;
            IntPtr Ishellv = IntPtr.Zero;
            Ishellv = Marshal.GetComInterfaceForObject(GetShellView(), typeof(IShellView));
            Marshal.QueryInterface(Ishellv, ref iid, out view);
            IColumnManager cm = (IColumnManager)Marshal.GetObjectForIUnknown(view);
            uint HeaderColsCount = 0;
            cm.GetColumnCount(All?CM_ENUM_FLAGS.CM_ENUM_ALL:CM_ENUM_FLAGS.CM_ENUM_VISIBLE, out HeaderColsCount);
            Collumns[] ci = new Collumns[HeaderColsCount];
            for (int i = 0; i < HeaderColsCount; i++)
            {
                Collumns col = new Collumns();
                PROPERTYKEY pk;
                CM_COLUMNINFO cmi;

                try
                {
                    GetColumnbyIndex(GetShellView(), All, i, out pk);
                    GetColumnInfobyIndex(GetShellView(), All, i, out cmi);
                    col.pkey = pk;
                    col.Name = cmi.wszName;
                    col.Width = (int)cmi.uWidth;
                    ci[i] = col;

                }
                catch 
                {


                }

            }


            return ci;
        }
Example #50
0
		// The below methods can be called into, but marshalling the response causes an exception to be
		// thrown from unmanaged code.  At this time, I decline calls requesting the ICommDlgBrowser2
		// interface.  This is logged as a bug, but moved to less of a priority, as it only affects being
		// able to change the default action text for remapping the default action.

		HResult ICommDlgBrowser3.GetDefaultMenuText(IShellView shellView, IntPtr text, int cchMax) {
			return HResult.False;
			//return HResult.Ok;
			//OK if new
			//False if default
			//other if error
		}
Example #51
0
		HResult ICommDlgBrowser3.OnColumnClicked(IShellView ppshv, int iColumn) {
			// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
			return HResult.Ok;
		}
        public bool LoadState(IShell shell, IShellView shellView, string fileName)
        {
            var layoutItems = new Dictionary<string, ILayoutItem>();

            if (!File.Exists(fileName))
            {
                return false;
            }

            FileStream stream = null;

            try
            {
                stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);

                using (var reader = new BinaryReader(stream))
                {
                    stream = null;

                    int count = reader.ReadInt32();

                    for (int i = 0; i < count; i++)
                    {
                        string typeName = reader.ReadString();
                        string contentId = reader.ReadString();
                        long stateEndPosition = reader.ReadInt64();
                        stateEndPosition += reader.BaseStream.Position;

                        var contentType = Type.GetType(typeName);
                        bool skipStateData = true;

                        if (contentType != null)
                        {
                            var contentInstance = IoC.GetInstance(contentType, null) as ILayoutItem;

                            if (contentInstance != null)
                            {
                                layoutItems.Add(contentId, contentInstance);

                                try
                                {
                                    contentInstance.LoadState(reader);
                                    skipStateData = false;
                                }
                                catch
                                {
                                    skipStateData = true;
                                }
                            }
                        }

                        // Skip state data block if we couldn't read it.
                        if (skipStateData)
                        {
                            reader.BaseStream.Seek(stateEndPosition, SeekOrigin.Begin);
                        }
                    }

                    shellView.LoadLayout(reader.BaseStream, shell.ShowTool, shell.OpenDocument, layoutItems);
                }
            }
            catch
            {
                return false;
            }
            finally
            {
                if (stream != null) {
                    stream.Close();
                }
            }

            return true;
        }
        public bool SaveState(IShell shell, IShellView shellView, string fileName)
        {
            FileStream stream = null;

            try
            {
                stream = new FileStream(fileName, FileMode.Create, FileAccess.Write);

                using (var writer = new BinaryWriter(stream))
                {
                    stream = null;

                    IEnumerable<ILayoutItem> itemStates = shell.Documents.Concat(shell.Tools.Cast<ILayoutItem>());

                    int itemCount = 0;
                    // reserve some space for items count, it'll be updated later
                    writer.Write(itemCount);

                    foreach (var item in itemStates)
                    {
                        if (!item.ShouldReopenOnStart)
                            continue;

                        var itemType = item.GetType();
                        List<ExportAttribute> exportAttributes = itemType
                                .GetCustomAttributes(typeof(ExportAttribute), false)
                                .Cast<ExportAttribute>().ToList();

                        var layoutType = typeof(ILayoutItem);
                        // get exports with explicit types or names that inherit from ILayoutItem
                        var exportTypes = (from att in exportAttributes
                                           // select the contract type if it is of type ILayoutitem. else null
                                           let typeFromContract = att.ContractType != null
                                               && layoutType.IsAssignableFrom(att.ContractType) ? att.ContractType : null
                                           // select the contract name if it is of type ILayoutItem. else null
                                           let typeFromQualifiedName = GetTypeFromContractNameAsILayoutItem(att)
                                           // select the viewmodel tpye if it is of type ILayoutItem. else null
                                           let typeFromViewModel = layoutType.IsAssignableFrom(itemType) ? itemType : null
                                           // att.ContractType overrides att.ContractName if both are set.
                                           // fall back to the ViewModel type of neither are defined.
                                           let type = typeFromContract ?? typeFromQualifiedName ?? typeFromViewModel
                                           where type != null
                                           select type).ToList();

                        // throw exceptions here, instead of failing silently. These are design time errors.
                        var firstExport = exportTypes.FirstOrDefault();
                        if (firstExport == null)
                            throw new InvalidOperationException(string.Format(
                                "A ViewModel that participates in LayoutItem.ShouldReopenOnStart must be decorated with an ExportAttribute who's ContractType that inherits from ILayoutItem, infringing type is {0}.", itemType));
                        if (exportTypes.Count > 1)
                            throw new InvalidOperationException(string.Format(
                                "A ViewModel that participates in LayoutItem.ShouldReopenOnStart can't be decorated with more than one ExportAttribute which inherits from ILayoutItem. infringing type is {0}.", itemType));

                        var selectedTypeName = firstExport.AssemblyQualifiedName;

                        if (string.IsNullOrEmpty(selectedTypeName))
                            throw new InvalidOperationException(string.Format(
                                "Could not retrieve the assembly qualified type name for {0}, most likely because the type is generic.", firstExport));
                        // TODO: it is possible to save generic types. It requires that every generic parameter is saved, along with its position in the generic tree... A lot of work.

                        writer.Write(selectedTypeName);
                        writer.Write(item.ContentId);

                        // Here's the tricky part. Because some items might fail to save their state, or they might be removed (a plug-in assembly deleted and etc.)
                        // we need to save the item's state size to be able to skip the data during deserialization.
                        // Save current stream position. We'll need it later.
                        long stateSizePosition = writer.BaseStream.Position;

                        // Reserve some space for item state size
                        writer.Write(0L);

                        long stateSize;

                        try
                        {
                            long stateStartPosition = writer.BaseStream.Position;
                            item.SaveState(writer);
                            stateSize = writer.BaseStream.Position - stateStartPosition;
                        }
                        catch
                        {
                            stateSize = 0;
                        }

                        // Go back to the position before item's state and write the actual value.
                        writer.BaseStream.Seek(stateSizePosition, SeekOrigin.Begin);
                        writer.Write(stateSize);

                        if (stateSize > 0)
                        {
                            // Got to the end of the stream
                            writer.BaseStream.Seek(0, SeekOrigin.End);
                        }

                        itemCount++;
                    }

                    writer.BaseStream.Seek(0, SeekOrigin.Begin);
                    writer.Write(itemCount);
                    writer.BaseStream.Seek(0, SeekOrigin.End);

                    shellView.SaveLayout(writer.BaseStream);
                }
            }
            catch
            {
                return false;
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }

            return true;
        }
 private static extern void GetColumnbyIndex(IShellView view, bool isAll, int index, out PROPERTYKEY res);
 private static extern void GetItemLocation(IShellView view, int index, out int pointx, out int pointy);
 public static extern int GetColumnInfobyIndex(IShellView view, bool isAll, int index, out CM_COLUMNINFO res);
 int IShellBrowser.OnViewWindowActive(IShellView pshv)
 {
     return WinError.E_NOTIMPL;
 }
Example #58
0
		HResult ICommDlgBrowser3.OnPreViewCreated(IShellView ppshv) {
			// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code
			return HResult.Ok;
		}
 private static extern void SetColumnInShellView(IShellView view, int count, [MarshalAs(UnmanagedType.LPArray)] PROPERTYKEY[] pk);
 private static extern void GetSortColumns(IShellView view, int index, out SORTCOLUMN sc);