Пример #1
0
        private void LoadTabs()
        {
            this.TabItems = new ObservableCollection <TabItem>();

            var trimmerView = new TrimmerView();

            this.TabItems.Add(new TabItem {
                Header = "Trimmer", Content = trimmerView
            });

            var trackOrderView = new TrackOrderView();

            this.TabItems.Add(new TabItem {
                Header = "Track Order", Content = trackOrderView
            });
        }
Пример #2
0
        /// <summary>
        /// Performs initialization and exports the types
        /// </summary>
        /// <param name="containerProvider">Container provider given by the Prism</param>
        public void OnInitialized(IContainerProvider containerProvider)
        {
            IoC             = containerProvider.Resolve <IUnityContainer>();
            EventAggregator = containerProvider.Resolve <IEventAggregator>();

            //Export simple types that are defined in PaunPacker.Core
            IoC.RegisterType <HeuristicBackgroundRemover>();
            IoC.RegisterType <PowerOfTwoSizePacker>();
            IoC.RegisterType <UnknownSizePacker>();

            IoC.RegisterFactory <BLAlgorithmPacker>((unityContainer) =>
            {
                var sorter = unityContainer.Resolve <IImageSorter>();
                if (sorter == null)
                {
                    return(new BLAlgorithmPacker());
                }
                return(new BLAlgorithmPacker(sorter));
            });

            IoC.RegisterType <MaximalRectanglesAlgorithm>();
            IoC.RegisterType <GuillotineBestAreaFitAlgorithm>();
            IoC.RegisterType <MaxRectsFreeRectanglePostProcessor>();
            IoC.RegisterType <MaxRectsFreeRectangleSortedMerger>();
            IoC.RegisterType <MaxRectsFreeRectangleSplitter>();

            IoC.RegisterType <ByHeightAndWidthImageSorter>();
            IoC.RegisterType <ByHeightAndWidthImageSorterDesc>();
            IoC.RegisterType <PreserveOrderImageSorter>();

            //FixedSize packers are handled directly from the PaunPacker.GUI (their GUI is MainWindow)

            //Export types that are accompanied by the GUI
            //Extruder
            var extruderView = new ExtruderView()
            {
                DataContext = new ExtruderViewModel(IoC)
            };
            //ColorTypeChanger
            //Trimmer
            var trimmerView = new TrimmerView()
            {
                DataContext = new TrimmerViewModel(IoC)
            };
            //CroppingTrimmer
            var croppingTrimmerView = new CroppingTrimmerView()
            {
                DataContext = new CroppingTrimmerViewModel(IoC)
            };
            //PaddingAdder
            var paddingAdderView = new PaddingAdderView()
            {
                DataContext = new PaddingAdderViewModel(IoC)
            };

            //Register the views
            IoC.RegisterInstance <UserControl>(PluginViewWiring.GetViewName(typeof(Extruder)), extruderView);
            IoC.RegisterInstance <UserControl>(PluginViewWiring.GetViewName(typeof(Trimmer)), trimmerView);
            IoC.RegisterInstance <UserControl>(PluginViewWiring.GetViewName(typeof(CroppingTrimmer)), croppingTrimmerView);
            IoC.RegisterInstance <UserControl>(PluginViewWiring.GetViewName(typeof(PaddingAdder)), paddingAdderView);
        }