예제 #1
0
        void showGuiPreview()
        {
            var waitIndicator = new WaitIndicator();

            waitIndicator.BeginWaiting(Left, Top, ActualWidth, ActualHeight);

            string assemblyDirectory = Path.GetDirectoryName(m_Project.AssemblyOfPreviewedGui);

            if (!string.IsNullOrEmpty(assemblyDirectory))
            {
                Directory.SetCurrentDirectory(assemblyDirectory);
            }

            m_Loader = m_LoaderFactory.Create();

            // Assemblies referenced from XAML through the "pack://application" syntax need to be loaded
            foreach (string assemblyToPreload in m_Project.PreloadedAssemblies)
            {
                m_Loader.PreloadAssembly(System.IO.Path.Combine(assemblyDirectory, assemblyToPreload));
            }

            // Load XAML Dictionaries like "pack://application:,,,/AnyAssembly;component/AnyPath/AnyResourceDictionary.xaml"
            m_Loader.AddMergedDictionary(m_Project.ResourceDictionaryToAdd);

            m_Loader.Load(m_Project.AssemblyOfPreviewedGui, m_Project.TypeOfPreviewedGui);

            var asmTypes = m_Loader.GetLoadedAssemblyTypeNames();

            viewModel.ListOfSelectedAssemblyTypes = new ObservableCollection <string>(asmTypes);

            m_Loader.Show();

            waitIndicator.EndWaiting();
        }
예제 #2
0
        public void ToggleType(string namespaceDotType, WaitIndicator waitIndicator = null)
        {
            var currentActiveRow = (from row in MainViewModel.ListOfSelectedAssemblyTypes
                                    where row.IsShown == true
                                    select row).FirstOrDefault();
            Loader.CloseWindow(); // will affect current active row through 'PreviewWindowClosed'
            if (currentActiveRow != null && currentActiveRow.NamespaceDotType == namespaceDotType)
            {
                LoaderConfiguration.TypeOfPreviewedGui = null;
                activateRow(null);
                return;
            }

            LoaderConfiguration.TypeOfPreviewedGui = namespaceDotType;
            activateRow(namespaceDotType);

            bool success = true;

            try
            {
                Loader.LoadType(namespaceDotType);
            }
            catch (MissingPreloadException e)
            {
                if (waitIndicator != null)
                    waitIndicator.EndWaiting(); // dark progress overlay shall not obscure the MessageBox
                showMessageBoxSeam(InnermostExceptionExtractor.GetInnermostMessage(e), MissingPreloadException.TitleTextOfAdvice);
                success = false;
            }
            catch (Exception e)
            {
                showMessageBoxSeam(InnermostExceptionExtractor.GetInnermostMessage(e), null);
                success = false;
            }

            if (success)
            {
                try
                {
                    Loader.Show();
                }
                catch(Exception e)
                {
                    showMessageBoxSeam(InnermostExceptionExtractor.GetInnermostMessage(e), null);
                    success = false;
                }
            }

            if (!success)
                activateRow(null);
        }
예제 #3
0
        void showGuiPreview()
        {
            var waitIndicator = new WaitIndicator();
            waitIndicator.BeginWaiting(Left, Top, ActualWidth, ActualHeight);

            string assemblyDirectory = Path.GetDirectoryName(m_Project.AssemblyOfPreviewedGui);
            if (!string.IsNullOrEmpty(assemblyDirectory))
                Directory.SetCurrentDirectory(assemblyDirectory);

            m_Loader = m_LoaderFactory.Create();

            // Assemblies referenced from XAML through the "pack://application" syntax need to be loaded
            foreach (string assemblyToPreload in m_Project.PreloadedAssemblies)
            {
                m_Loader.PreloadAssembly(System.IO.Path.Combine(assemblyDirectory, assemblyToPreload));
            }

            // Load XAML Dictionaries like "pack://application:,,,/AnyAssembly;component/AnyPath/AnyResourceDictionary.xaml"
            m_Loader.AddMergedDictionary(m_Project.ResourceDictionaryToAdd);

            m_Loader.Load(m_Project.AssemblyOfPreviewedGui, m_Project.TypeOfPreviewedGui);

            var asmTypes = m_Loader.GetLoadedAssemblyTypeNames();
            viewModel.ListOfSelectedAssemblyTypes = new ObservableCollection<string>(asmTypes);

            m_Loader.Show();

            waitIndicator.EndWaiting();
        }
예제 #4
0
 public void SetWaitIndicator(WaitIndicator waitIndicator)
 {
     m_WaitIndicator = waitIndicator;
 }