public ShellVM(IRegionManager regionManager,IRibbonService ribbonService)
 {
     this.regionManager = regionManager;
     this.ribbonService = ribbonService;
     this.goBackCommand = new DelegateCommand(GoBack);
     this.goForwardCommand = new DelegateCommand(GoForward);
 }
 public ShellVM(IRegionManager regionManager, IRibbonService ribbonService)
 {
     this.regionManager    = regionManager;
     this.ribbonService    = ribbonService;
     this.goBackCommand    = new DelegateCommand(GoBack);
     this.goForwardCommand = new DelegateCommand(GoForward);
 }
Example #3
0
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            var orchestraService = GetService <IOrchestraService>();

            ribbonService.RegisterRibbonItem(new RibbonButton(HomeRibbonTabName, ModuleName, "PluginManager", new Command(Func)));
            base.InitializeRibbon(ribbonService);
        }
Example #4
0
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            // Module specific
            // TODO: Register module specific ribbon items

            // View specific
            // TODO: Register view specific ribbon items
        }
Example #5
0
        public MainVM(
            IRibbonService ribbonService,
            IRegionManager regionManager
            )
         {
            this.ribbonService = ribbonService;
            this.regionManager = regionManager;

            this.aboutCommand = new DelegateCommand(this.About);
         }
Example #6
0
        public MainVM(
            IRibbonService ribbonService,
            IRegionManager regionManager
            )
        {
            this.ribbonService = ribbonService;
            this.regionManager = regionManager;

            this.aboutCommand = new DelegateCommand(this.About);
        }
Example #7
0
        public WorkHourVM(
            IRibbonService ribbonService,
            IWorkCodeService workCodeService,
            IEmployeeService employeeService,
            IWorkHourService workHourService
            )
        {
            this.ribbonService   = ribbonService;
            this.saveCommand     = new DelegateCommand <bool?>(this.Save, this.CanSave);
            this.deleteCommand   = new DelegateCommand <bool?>(this.Delete, this.CanDelete);
            this.workCodeService = workCodeService;
            this.workHourService = workHourService;

            WorkCodes = new ObservableCollection <BasicWorkCodeVM>();
            employees = new ObservableCollection <BasicEmployeeVM>();
            workHours = new ObservableCollection <BasicWorkHourVM>();


            DeletedWorkHours = new List <BasicWorkHourVM>();



            Mapper.CreateMap <Employee, BasicEmployeeVM>();
            Mapper.CreateMap <BasicEmployeeVM, Employee>();
            Mapper.CreateMap <ICollection <Employee>, ICollection <BasicEmployeeVM> >();
            Mapper.CreateMap <ICollection <BasicEmployeeVM>, ICollection <Employee> >();

            Mapper.CreateMap <WorkCode, BasicWorkCodeVM>();
            Mapper.CreateMap <ICollection <WorkCode>, ICollection <BasicWorkCodeVM> >();
            Mapper.CreateMap <BasicWorkCodeVM, WorkCode>();
            Mapper.CreateMap <ICollection <BasicWorkCodeVM>, ICollection <WorkCode> >();

            Mapper.CreateMap <WorkHour, BasicWorkHourVM>();
            Mapper.CreateMap <BasicWorkHourVM, WorkHour>();
            Mapper.CreateMap <ICollection <WorkHour>, ICollection <BasicWorkHourVM> >();
            Mapper.CreateMap <ICollection <BasicWorkHourVM>, ICollection <WorkHour> >();

            foreach (Employee data in employeeService.GetAll())
            {
                employees.Add(Mapper.Map <Employee, BasicEmployeeVM>(data));
            }

            foreach (WorkCode data in workCodeService.GetAll())
            {
                WorkCodes.Add(Mapper.Map <WorkCode, BasicWorkCodeVM>(data));
            }

            foreach (WorkHour data in workHourService.GetAll())
            {
                data.ObjectState = ObjectState.Unchanged;
                workHours.Add(Mapper.Map <WorkHour, BasicWorkHourVM>(data));
            }
            WorkHoursCV = new ListCollectionView(WorkHours);
            WorkHoursCV.CurrentChanged += WorkHoursCV_CurrentChanged;
        }
        public WorkHourVM(
            IRibbonService ribbonService,
            IWorkCodeService workCodeService,
            IEmployeeService employeeService,
            IWorkHourService workHourService
            )
        {
            this.ribbonService = ribbonService;
            this.saveCommand = new DelegateCommand<bool?>(this.Save, this.CanSave);
            this.deleteCommand = new DelegateCommand<bool?>(this.Delete, this.CanDelete);
            this.workCodeService=workCodeService;
            this.workHourService = workHourService;

            WorkCodes = new ObservableCollection<BasicWorkCodeVM>();
            employees = new ObservableCollection<BasicEmployeeVM>();
            workHours = new ObservableCollection<BasicWorkHourVM>();


            DeletedWorkHours = new List<BasicWorkHourVM>();

          

            Mapper.CreateMap<Employee, BasicEmployeeVM>();
            Mapper.CreateMap<BasicEmployeeVM, Employee>();
            Mapper.CreateMap<ICollection<Employee>, ICollection<BasicEmployeeVM>>();
            Mapper.CreateMap<ICollection<BasicEmployeeVM>, ICollection<Employee>>();
            
            Mapper.CreateMap<WorkCode, BasicWorkCodeVM>();
            Mapper.CreateMap<ICollection<WorkCode>, ICollection<BasicWorkCodeVM>>();
            Mapper.CreateMap<BasicWorkCodeVM, WorkCode>();
            Mapper.CreateMap<ICollection<BasicWorkCodeVM>, ICollection<WorkCode>>();
            
            Mapper.CreateMap<WorkHour, BasicWorkHourVM>();
            Mapper.CreateMap<BasicWorkHourVM, WorkHour>();
            Mapper.CreateMap<ICollection<WorkHour>, ICollection<BasicWorkHourVM>>();
            Mapper.CreateMap<ICollection<BasicWorkHourVM>, ICollection<WorkHour>>();

            foreach (Employee data in employeeService.GetAll())
            {
                employees.Add(Mapper.Map<Employee, BasicEmployeeVM>(data));
            }
            
            foreach (WorkCode data in workCodeService.GetAll())
            {
                WorkCodes.Add(Mapper.Map<WorkCode, BasicWorkCodeVM>(data));
            }

            foreach (WorkHour data in workHourService.GetAll())
            {
                data.ObjectState = ObjectState.Unchanged;
                workHours.Add(Mapper.Map<WorkHour, BasicWorkHourVM>(data));
            }
            WorkHoursCV = new ListCollectionView(WorkHours);
            WorkHoursCV.CurrentChanged += WorkHoursCV_CurrentChanged;
        }
Example #9
0
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            var orchestraService = GetService <IOrchestraService>();

            // Module specific
            ribbonService.RegisterRibbonItem(new RibbonButton(HomeRibbonTabName, ModuleName, "Show", new Command(() => orchestraService.ShowDocument <PlotDemoViewModel>()))
            {
                ItemImage = "/Orchestra.Modules.PlotDemo;component/Resources/Images/Graph.png"
            });

            // View specific
            // TODO: Register view specific ribbon items
        }
Example #10
0
        public EmployeeVM(
            IRibbonService ribbonService,
            IEmployeeService employeeService
            )
        {
            this.ribbonService = ribbonService;
            this.saveCommand   = new DelegateCommand <bool?>(this.Save, this.CanSave);

            employee = new BasicEmployeeVM();

            Mapper.CreateMap <WorkCode, BasicWorkCodeVM>();

            this.employeeService = employeeService;
        }
Example #11
0
 public ShellService(IRibbonService ribbonServce)
 {
     _ribbonService = ribbonServce;
     System.Diagnostics.Debug.Assert(_created == false);
     _created = true;
     _tools   = new ObservableCollection <IToolViewModel>();
     BindingOperations.EnableCollectionSynchronization(_tools, _lock);
     _documents = new ObservableCollection <IDocumentViewModel>();
     //Creates the lock object somewhere
     BindingOperations.EnableCollectionSynchronization(_documents, _lock);
     _documentsUnopen = new ObservableCollection <DocumentUnopenBase>();
     BindingOperations.EnableCollectionSynchronization(_documentsUnopen, _lock);
     CurrentCulture = string.IsNullOrEmpty(Metaseed.ShellBase.Properties.Settings.Default.Culture) ? CultureInfo.CurrentUICulture : new CultureInfo(Metaseed.ShellBase.Properties.Settings.Default.Culture);
     CurrentTheme   = string.IsNullOrEmpty(Metaseed.ShellBase.Properties.Settings.Default.Theme) ? AppTheme.Office2013 : (AppTheme)Enum.Parse(typeof(AppTheme), Metaseed.ShellBase.Properties.Settings.Default.Theme);
 }
        public EmployeeVM(
            IRibbonService ribbonService,
            IEmployeeService employeeService
            )
        {
            this.ribbonService = ribbonService;
            this.saveCommand = new DelegateCommand<bool?>(this.Save, this.CanSave);
           
            employee = new BasicEmployeeVM(); 

            Mapper.CreateMap<WorkCode, BasicWorkCodeVM>();

            this.employeeService = employeeService;

        }
Example #13
0
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            var orchestraService = GetService <IOrchestraService>();

            // Module specific
            ribbonService.RegisterRibbonItem(
                new RibbonButton(HomeRibbonTabName, ModuleName, "Open", new Command(() => orchestraService.ShowDocument <DataGridViewModel>()))
            {
                ItemImage = "/Orchestra.Modules.DataGrid;component/Resources/Images/Table.png"
            });

            // View specific
            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "File", "Open", "OpenFileCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/FileOpen.png"
            },
                ModuleName);
            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "File", "Save", "SaveToFileCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/FileSave.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "Rows", "Add", "AddRowCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/ActionAdd.png"
            },
                ModuleName);
            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "Rows", "Remove", "RemoveRowCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/ActionRemove.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "Tools", "Plot", "Plot")
            {
                ItemImage = "/Orchestra.Modules.DataGrid;component/Resources/Images/ActionPlot.png"
            },
                ModuleName);
        }
Example #14
0
        public WorkCodeVM(
            IRibbonService ribbonService,
            IWorkCodeService workCodeService
            )
        {
            EntityType           = typeof(BasicWorkCodeVM);
            this.ribbonService   = ribbonService;
            this.saveCommand     = new DelegateCommand <bool?>(this.Save, this.CanSave);
            this.deleteCommand   = new DelegateCommand <bool?>(this.Delete, this.CanDelete);
            this.workCodeService = workCodeService;

            WorkCodes        = new ObservableCollection <BasicWorkCodeVM>();
            DeletedWorkCodes = new List <BasicWorkCodeVM>();
            Mapper.CreateMap <WorkCode, BasicWorkCodeVM>();
            foreach (WorkCode data in workCodeService.GetAll())
            {
                data.ObjectState = ObjectState.Unchanged;

                WorkCodes.Add(Mapper.Map <WorkCode, BasicWorkCodeVM>(data));
            }
            WorkCodesCV = new ListCollectionView(WorkCodes);
            WorkCodesCV.CurrentChanged += WorkCodesCV_CurrentChanged;
        }
        public EmployeesVM(
            IRibbonService ribbonService,
            IEmployeeService employeeService,
            IRegionManager regionManager
            )
        {
            this.ribbonService = ribbonService;
            this.newCommand = new DelegateCommand<bool?>(this.New, this.CanNew);
            this.deleteCommand = new DelegateCommand<bool?>(this.Delete, this.CanDelete);
            this.editCommand = new DelegateCommand<bool?>(this.Edit, this.CanEdit);

            this.ViewRequest = new InteractionRequest<INotification>();

            employees = new ObservableCollection<BasicEmployeeVM>();
            RegionManager = regionManager;
            Mapper.CreateMap<Employee, BasicEmployeeVM>();
            Mapper.CreateMap<WorkCode, BasicWorkCodeVM>();
            Mapper.CreateMap<WorkHour, BasicWorkHourVM>();

            Mapper.CreateMap<BasicWorkCodeVM, WorkCode>();
            Mapper.CreateMap<BasicEmployeeVM, Employee>();

            Mapper.CreateMap<ICollection<WorkHour>, ICollection<BasicWorkHourVM>>();
            Mapper.CreateMap<ICollection<WorkCode>, ICollection<BasicWorkCodeVM>>();
            Mapper.CreateMap<ICollection<Employee>, ICollection<BasicEmployeeVM>>();
            Mapper.CreateMap<ICollection<BasicWorkHourVM>, ICollection<WorkHour>>();

            foreach (Employee data in employeeService.GetAll())
            {
                employees.Add(Mapper.Map<Employee, BasicEmployeeVM>(data));
            }

            EmployeesCV = new ListCollectionView(Employees);
            EmployeesCV.CurrentChanged += EmployeesCV_CurrentChanged;
            this.employeeService = employeeService;
        }
 public TCDashboardVM(
   IRibbonService ribbonService,
     IRegionManager regionManager,
     IRegionViewRegistry regionRegistry,
     IWorkHourService workHourService,
     IEmployeeService employeeService
   )
 {
     this.ribbonService = ribbonService;
     this.aboutCommand = new DelegateCommand(this.About);
     employeesCommand = new DelegateCommand(this.Employees);
     addEmployeeCommand = new DelegateCommand(this.AddEmployees);
     workHoursCommand = new DelegateCommand(this.WorkHoursEmployees);
     bheCommand = new DelegateCommand(this.BHE);
     nbheCommand = new DelegateCommand(this.NBHE);
     phonesCommand = new DelegateCommand(this.Phones);
     addressCommand = new DelegateCommand(this.Address);
     workCodesCommand = new DelegateCommand(this.WorkCodes);
     this.ViewRequest = new InteractionRequest<INotification>();
     this.regionManager = regionManager;
     this.regionRegistry = regionRegistry;
     this.workHourService = workHourService;
     this.employeeService = employeeService;
 }
        public EmployeesVM(
            IRibbonService ribbonService,
            IEmployeeService employeeService,
            IRegionManager regionManager
            )
        {
            this.ribbonService = ribbonService;
            this.newCommand    = new DelegateCommand <bool?>(this.New, this.CanNew);
            this.deleteCommand = new DelegateCommand <bool?>(this.Delete, this.CanDelete);
            this.editCommand   = new DelegateCommand <bool?>(this.Edit, this.CanEdit);

            this.ViewRequest = new InteractionRequest <INotification>();

            employees     = new ObservableCollection <BasicEmployeeVM>();
            RegionManager = regionManager;
            Mapper.CreateMap <Employee, BasicEmployeeVM>();
            Mapper.CreateMap <WorkCode, BasicWorkCodeVM>();
            Mapper.CreateMap <WorkHour, BasicWorkHourVM>();

            Mapper.CreateMap <BasicWorkCodeVM, WorkCode>();
            Mapper.CreateMap <BasicEmployeeVM, Employee>();

            Mapper.CreateMap <ICollection <WorkHour>, ICollection <BasicWorkHourVM> >();
            Mapper.CreateMap <ICollection <WorkCode>, ICollection <BasicWorkCodeVM> >();
            Mapper.CreateMap <ICollection <Employee>, ICollection <BasicEmployeeVM> >();
            Mapper.CreateMap <ICollection <BasicWorkHourVM>, ICollection <WorkHour> >();

            foreach (Employee data in employeeService.GetAll())
            {
                employees.Add(Mapper.Map <Employee, BasicEmployeeVM>(data));
            }

            EmployeesCV = new ListCollectionView(Employees);
            EmployeesCV.CurrentChanged += EmployeesCV_CurrentChanged;
            this.employeeService        = employeeService;
        }
 public TCDashboardVM(
     IRibbonService ribbonService,
     IRegionManager regionManager,
     IRegionViewRegistry regionRegistry,
     IWorkHourService workHourService,
     IEmployeeService employeeService
     )
 {
     this.ribbonService   = ribbonService;
     this.aboutCommand    = new DelegateCommand(this.About);
     employeesCommand     = new DelegateCommand(this.Employees);
     addEmployeeCommand   = new DelegateCommand(this.AddEmployees);
     workHoursCommand     = new DelegateCommand(this.WorkHoursEmployees);
     bheCommand           = new DelegateCommand(this.BHE);
     nbheCommand          = new DelegateCommand(this.NBHE);
     phonesCommand        = new DelegateCommand(this.Phones);
     addressCommand       = new DelegateCommand(this.Address);
     workCodesCommand     = new DelegateCommand(this.WorkCodes);
     this.ViewRequest     = new InteractionRequest <INotification>();
     this.regionManager   = regionManager;
     this.regionRegistry  = regionRegistry;
     this.workHourService = workHourService;
     this.employeeService = employeeService;
 }
        public WorkCodeVM(
            IRibbonService ribbonService,
            IWorkCodeService workCodeService
            )
        {
            EntityType =typeof(BasicWorkCodeVM);
            this.ribbonService = ribbonService;
            this.saveCommand = new DelegateCommand<bool?>(this.Save, this.CanSave);
            this.deleteCommand = new DelegateCommand<bool?>(this.Delete, this.CanDelete);
            this.workCodeService=workCodeService;

            WorkCodes = new ObservableCollection<BasicWorkCodeVM>();
            DeletedWorkCodes = new List<BasicWorkCodeVM>();
            Mapper.CreateMap<WorkCode, BasicWorkCodeVM>();
            foreach (WorkCode data in workCodeService.GetAll())
            {
                data.ObjectState = ObjectState.Unchanged;
                
                WorkCodes.Add(Mapper.Map<WorkCode, BasicWorkCodeVM>(data));
            }
            WorkCodesCV = new ListCollectionView(WorkCodes);
            WorkCodesCV.CurrentChanged += WorkCodesCV_CurrentChanged;

        }
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            LoadResourceDictionary();

            var orchestraService = GetService <IOrchestraService>();

            // Module specific
            var typeFactory = TypeFactory.Default;

            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.HomeRibbonTabName, ModuleName, BrowserModuleResources.OpenNewBrowserModuleMenuItem, new Command(() =>
            {
                var browserViewModel = typeFactory.CreateInstance <BrowserViewModel>();
                orchestraService.ShowDocument(browserViewModel);
            }))
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_browse.png"
            });

            // View specific
            var backButton = new RibbonButton(Name, Name, BrowserModuleResources.GoBackMenuItem, "GoBack")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_left.png"
            };
            var forwardButton = new RibbonButton(Name, Name, BrowserModuleResources.GoForwardMenuItem, "GoForward")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_right.png"
            };

            ribbonService.RegisterContextualRibbonItem <BrowserView>(backButton, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(forwardButton, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonButton(Name, Name, BrowserModuleResources.BrowseMenuItem, "Browse")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_browse.png"
            }, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonSplitButton(Name, Name, BrowserModuleResources.CloseMenuItem, "CloseBrowser")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_close.png",
                ToolTip   = new RibbonToolTip {
                    Title = BrowserModuleResources.CloseRibbonToolTipTitle, Text = BrowserModuleResources.CloseRibbonToolTipText
                },
                Items = new List <IRibbonItem>
                {
                    new RibbonGallery
                    {
                        Items = new List <IRibbonItem> {
                            backButton, forwardButton
                        },
                        Orientation = Orientation.Horizontal,
                        ItemWidth   = 56, ItemHeight = 64
                    }
                }
            }, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonComboBox(Name, BrowserModuleResources.RecentSitesMenuItem)
            {
                ItemsSource  = "RecentSites",
                SelectedItem = "SelectedSite",
                Layout       = new RibbonItemLayout {
                    Width = 150
                },
                Style = Application.Current.Resources["SelectedSitesComboBoxStyle"] as Style
            }, ModuleName);

            // Find the template to show as dynamic content. TODO: Refactor, make more elegant.
            var template = Application.Current.Resources["TestTemplate"] as DataTemplate;

            //ribbonService.RegisterContextualRibbonItem<BrowserView>(new RibbonContentControl(Name, "Dynamic content") { ContentTemplate = template, Layout = new RibbonItemLayout {Width = 120}}, ModuleName);

            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.ViewRibbonTabName, ModuleName, BrowserModuleResources.BrowserPropertiesViewHeader, new Command(() =>
            {
                orchestraService.ShowDocumentIfHidden <PropertiesViewModel>();
            }))
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_browse.png"
            });

            var dockingSettings = new DockingSettings();

            dockingSettings.DockLocation = DockLocation.Right;
            dockingSettings.Width        = 225;

            // Demo: register contextual view related to browserview
            var contextualViewModelManager = GetService <IContextualViewModelManager>();

            contextualViewModelManager.RegisterContextualView <BrowserViewModel, PropertiesViewModel>(BrowserModuleResources.BrowserPropertiesViewHeader, dockingSettings);

            // Demo: show two pages with different tags
            var orchestraViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <BrowserViewModel>("Orchestra");

            orchestraViewModel.Url = "http://www.github.com/Orcomp/Orchestra";
            orchestraService.ShowDocument(orchestraViewModel, "orchestra");

            var catelViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <BrowserViewModel>("Catel");

            catelViewModel.Url = "http://www.catelproject.com";
            orchestraService.ShowDocument(catelViewModel, "catel");
        }
Example #21
0
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            LoadResourceDictionary();

            var orchestraService = GetService <IOrchestraService>();

            // Module specific
            var typeFactory      = TypeFactory.Default;
            var browserViewModel = typeFactory.CreateInstance <BrowserViewModel>();

            ribbonService.RegisterRibbonItem(new RibbonButton(HomeRibbonTabName, ModuleName, "Open", new Command(() => orchestraService.ShowDocument(browserViewModel)))
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_browse.png"
            });

            // View specific
            var backButton = new RibbonButton(Name, Name, "Back", "GoBack")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_left.png"
            };
            var forwardButton = new RibbonButton(Name, Name, "Forward", "GoForward")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_right.png"
            };

            ribbonService.RegisterContextualRibbonItem <BrowserView>(backButton, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(forwardButton, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonButton(Name, Name, "Browse", "Browse")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_browse.png"
            }, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonSplitButton(Name, Name, "Close", "CloseBrowser")
            {
                ItemImage = "/Orchestra.Modules.Browser;component/Resources/Images/action_close.png",
                ToolTip   = new RibbonToolTip {
                    Title = "Close (Ctrl+X)", Text = "Closes the browser page."
                },
                Items = new List <IRibbonItem>
                {
                    new RibbonGallery
                    {
                        Items = new List <IRibbonItem> {
                            backButton, forwardButton
                        },
                        Orientation = Orientation.Horizontal,
                        ItemWidth   = 56, ItemHeight = 64
                    }
                }
            }, ModuleName);
            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonComboBox(Name, "Recent Sites")
            {
                ItemsSource  = "RecentSites",
                SelectedItem = "SelectedSite",
                Layout       = new RibbonItemLayout {
                    Width = 150
                },
                Style = Application.Current.Resources["SelectedSitesComboBoxStyle"] as Style
            }, ModuleName);

            // Find the template to show as dynamic content. TODO: Refactor, make more elegant.
            var template = Application.Current.Resources["TestTemplate"] as DataTemplate;

            ribbonService.RegisterContextualRibbonItem <BrowserView>(new RibbonContentControl(Name, "Dynamic content")
            {
                ContentTemplate = template, Layout = new RibbonItemLayout {
                    Width = 120
                }
            }, ModuleName);

            // Demo: show two pages with different tags
            var orchestraViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <BrowserViewModel>("Orchestra");

            orchestraViewModel.Url = "http://www.github.com/Orcomp/Orchestra";
            orchestraService.ShowDocument(orchestraViewModel, "orchestra");

            var catelViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <BrowserViewModel>("Catel");

            catelViewModel.Url = "http://www.catelproject.com";
            orchestraService.ShowDocument(catelViewModel, "catel");
        }
Example #22
0
 public ReportWindowVM(IRibbonService ribbonService)
 {
     this.ribbonService = ribbonService;
     printCommand       = new DelegateCommand(Print);
 }
Example #23
0
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            LoadResourceDictionary();

            orchestraService = GetService <IOrchestraService>();

            // Module specific
            var typeFactory = TypeFactory.Default;

            //ribbonService.RegisterRibbonItem(new RibbonButton(HomeRibbonTabName, ModuleName, "Open", new Command(() => NewDocumentCommand.Execute(null))) { ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png" });
            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.HomeRibbonTabName, ModuleName, "Open", new Command(() =>
            {
                var textEditorViewModel = typeFactory.CreateInstance <TextEditorViewModel>();
                orchestraService.ShowDocument(textEditorViewModel);
            }))
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png"
            });

            // View specific
            #region File Buttons

            // View specific
            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "New", new Command(() => NewDocumentCommand.Execute(null)))
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_New32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "Open", new Command(() => OpenDocumentCommand.Execute(null)))
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_Open32.png"
            },
                ModuleName);

            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(
            //   new RibbonButton(Name, "File", "Open", "OpenDocumentCommand") { ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_Open32.png" },
            //   ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "Save", "SaveCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_Save32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "SaveAs", "SaveAsCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_SaveAs32.png"
            },
                ModuleName);

            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(
            //  new RibbonButton(Name, "File", "CloseMe", new Command(() => CloseDocumentCommand.Execute(null)))
            //  {
            //      ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/action_close.png",
            //      ToolTip = new RibbonToolTip { Title = "Close (Ctrl+X)", Text = "Closes the file." }
            //  },
            //ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "CloseMe", "CloseDocument")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/action_close.png",
                ToolTip   = new RibbonToolTip {
                    Title = "Close (Ctrl+X)", Text = "Closes the file."
                }
            },
                ModuleName);
            #endregion

            #region Edit Buttons

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Copy", ApplicationCommands.Copy)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Copy32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Cut", ApplicationCommands.Cut)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Cut32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Paste", ApplicationCommands.Paste)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Paste32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Delete", ApplicationCommands.Delete)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Delete32.png"
            },
                ModuleName);

            #endregion

            #region Undo / Redo Buttons

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Undo", "Undo", ApplicationCommands.Undo)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Undo32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Undo", "Redo", ApplicationCommands.Redo)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Redo32.png"
            },
                ModuleName);

            #endregion

            #region Text Editor Buttons
            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Text Editor", "WordWrap", "WordWrapCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Text Editor", "LineNumbers", "ShowLineNumbersCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Numbers32.png"
            },
                ModuleName);
            #endregion

            #region ScriptCS  Buttons
            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Run ScriptCS", "ScriptCS", "ScriptCSCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/cs_32.png"
            },
                ModuleName);

            #endregion

            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(
            // new RibbonButton(Name, "Document", "Map", new Command(() => ShowDocumentMapCommand.Execute(null))) { ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/ShowWordWrap32.png" },
            // ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Document", "Map", "DocumentMapOpenCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/ShowWordWrap32.png"
            },
                ModuleName);

            #region TextEditor Module

            // Language selection combobox
            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(new RibbonComboBox(Name, "Languages")
            //{
            //    ItemsSource = "SyntaxHighlighting",
            //    SelectedItem = "SelectedLanguage",
            //    Layout = new RibbonItemLayout { Width = 100 },
            //    Style = Application.Current.Resources["SelectedSitesComboBoxStyle"] as Style
            //}, ModuleName);

            // Find the template to show as dynamic content. TODO: Refactor, make more elegant.
            var template = Application.Current.Resources["TestTemplate"] as DataTemplate;


            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.ViewRibbonTabName, ModuleName, "TextEditor properties", new Command(() =>
            {
                orchestraService.ShowDocumentIfHidden <PropertiesViewModel>();
            }))
            {
                ItemImage = "/rchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png"
            });

            #endregion

            var dockingSettings = new DockingSettings();
            dockingSettings.DockLocation = DockLocation.Right;
            dockingSettings.Width        = 225;

            // Demo: register contextual view related to browserview
            var contextualViewModelManager = GetService <IContextualViewModelManager>();
            contextualViewModelManager.RegisterContextualView <TextEditorViewModel, PropertiesViewModel>("Document Map", DockLocation.Right);

            // Open blank document during application start
            var currenttextEditorViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <TextEditorViewModel>("Orchestra", this);
            //orchestraViewModel.Url = "http://www.github.com/Orcomp/Orchestra";
            orchestraService.ShowDocument(currenttextEditorViewModel, "New Document");
        }
Example #24
0
 /// <summary>
 /// Initializes the ribbon.
 /// <para />
 /// Use this method to hook up views to ribbon items.
 /// </summary>
 /// <param name="ribbonService">The ribbon service.</param>
 protected virtual void InitializeRibbon(IRibbonService ribbonService)
 {
 }
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            var orchestraService = GetService <IOrchestraService>();
            var typeFactory      = TypeFactory.Default;

            // Module specific
            ribbonService.RegisterRibbonItem(
                new RibbonButton(OrchestraResources.HomeRibbonTabName, ModuleName, "Open", new Command(() => _orchestraService.ShowDocument <DataGridViewModel>()))
            {
                ItemImage = "/Orchestra.Modules.DataGrid;component/Resources/Images/Table.png"
            });

            // View specific
            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "File", "Open", "OpenFileCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/FileOpen.png"
            },
                ModuleName);
            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "File", "Save", "SaveToFileCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/FileSave.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "Rows", "Add", "AddRowCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/ActionAdd.png"
            },
                ModuleName);
            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "Rows", "Remove", "RemoveRowCommand")
            {
                ItemImage = "/Orchestra.Library;component/Resources/Images/ActionRemove.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <DataGridView>(
                new RibbonButton(Name, "Tools", "Plot", "Plot")
            {
                ItemImage = "/Orchestra.Modules.DataGrid;component/Resources/Images/ActionPlot.png"
            },
                ModuleName);

            var contextualViewModelManager = GetService <IContextualViewModelManager>();

            // Demo: Register the view as a Nested dockingmanager
            contextualViewModelManager.RegisterNestedDockView <DataGridViewModel>();

            DockingSettings dockingSettings = new DockingSettings();

            dockingSettings.DockLocation = DockLocation.Right;
            dockingSettings.Top          = 100;
            dockingSettings.Left         = 450;
            dockingSettings.Width        = 200;
            dockingSettings.Height       = 200;

            // Demo: Register context sensitive view, within the Nested dockingmanager
            contextualViewModelManager.RegisterContextualView <DataGridViewModel, DataGridPropertiesViewModel>("Datagrid properties", dockingSettings);

            // Add the contextual view in the "View" menu
            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.ViewRibbonTabName, ModuleName, "Browser properties",
                                                              new Command(() => orchestraService.ShowDocumentIfHidden <DataGridPropertiesViewModel>()))
            {
                ItemImage = "/Orchestra.Modules.DataGrid;component/Resources/Images/Table.png"
            });

            // Test showing a datagrid view at startup
            var dataGridViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <DataGridViewModel>("Datagrid");

            orchestraService.ShowDocument(dataGridViewModel, "Datagrid");
        }