示例#1
0
        public AssetBrowserView(List <IGameArchiveManager> managers, List <string> AvaliableClasses) : base(DataWindowMode.Custom)
        {
            InitializeComponent();
            ControlzEx.Theming.ThemeManager.Current.ChangeTheme(this, "Dark.Red"); //This aint needed was just for testing remove me.
            var vm = new AssetBrowserViewModel(managers, AvaliableClasses);

            NotifyPropertyChanged();
            this.DataContext = vm;
            viewmodel        = vm;
        }
示例#2
0
        public async Task <PackageSessionResult> LoadProject(string path)
        {
            var viewUpdater = Services.GetService <IViewUpdater>();

            PackageSessionResult sessionResult = await SetupResultProgress(viewUpdater, LoadProjectScope);

            using (var scope = new TimedScope(LoadProjectScope, TimedScope.Status.Failure))
            {
                // Force PackageSession.Load to be executed on the thread pool
                // otherwise it would block execution and we want this process to be async
                await Task.Run(() =>
                {
                    PackageSession.Load(path, sessionResult);
                }).ConfigureAwait(false);

                PackageSession = sessionResult.Session;

                foreach (var pkg in PackageSession.LocalPackages)
                {
                    pkg.UpdateAssemblyReferences(LoggingScope.Global($"{nameof(Session)}.{nameof(pkg.UpdateAssemblyReferences)}"));
                }

                if (!sessionResult.HasErrors)
                {
                    scope.Result = TimedScope.Status.Success;
                }
            }

            // Create asset browser for package and add it to the viewmodel
            var browser = new AssetBrowserViewModel(PackageSession);
            await Services.GetService <ITabManager>().CreateToolTab(browser);

            EditorViewModel.LoadingStatus = null;
            await viewUpdater.UpdateView();

            ProjectLoaded?.Invoke(sessionResult);

            return(sessionResult);
        }
示例#3
0
 public AssetBrowser()
 {
     DataContext = new AssetBrowserViewModel(this);
     InitializeComponent();
 }