示例#1
0
 public CatalogController(
     ICatalogRepository repository,
     ITaskRepository taskRepository,
     ICatalogView catalogView,
     INewCatalogView newCatalogView,
     INewSupplyView newSupplyView,
     INewHardwareView newHardwareView,
     IEditSupplyView editSupplyView,
     IEditHardwareView editHardwareView,
     INewHardwareSupplyView newHardwareSupplyView,
     IEditHardwareSupplyView editHardwareSupplyView,
     IImportHardwareView importHardwareView,
     ILoadingView loadingView)
 {
     this.catalogView = catalogView;
     this.newCatalogView = newCatalogView;
     this.newSupplyView = newSupplyView;
     this.newHardwareView = newHardwareView;
     this.editSupplyView = editSupplyView;
     this.editHardwareView = editHardwareView;
     this.newHardwareSupplyView = newHardwareSupplyView;
     this.editHardwareSupplyView = editHardwareSupplyView;
     this.importHardwareView = importHardwareView;
     this.loadingView = loadingView;
     this.repository = repository;
     this.taskRepository = taskRepository;
 }
示例#2
0
 public ProjectController(
     IProjectView projectView, 
     INewProjectView newProjectView, 
     IProjectRepository projectRepository, 
     IDealRepository dealRepository,
     INewProjectSupplyView newProjectSupplyView,
     INewProjectHardwareView newProjectHardwareView,
     IEditProjectSupplyView editProjectSupplyView,
     IEditProjectHardwareView editProjectHardwareView,
     INewProjectFrameView newProjectFrameView,
     IEditProjectHardwareSupplyView editProjectHardwareSupplyView,
     ILoadingView loadingView,
     ICatalogRepository catalogRepository,
     ITaskRepository taskRepository)
 {
     this.projectView = projectView;
     this.newProjectView = newProjectView;
     this.projectRepository = projectRepository;
     this.dealRepository = dealRepository;
     this.newProjectSupplyView = newProjectSupplyView;
     this.newProjectHardwareView = newProjectHardwareView;
     this.editProjectHardwareView = editProjectHardwareView;
     this.editProjectSupplyView = editProjectSupplyView;
     this.newProjectFrameView = newProjectFrameView;
     this.editProjectHardwareSupplyView = editProjectHardwareSupplyView;
     this.loadingView = loadingView;
     this.catalogRepository = catalogRepository;
     this.taskRepository = taskRepository;
 }
示例#3
0
 public LoadingPresenter(/*IProductService s*/IProductRepository r, ILoadingView v, LoadingModel m)
 {
     //Service = s;
       Repository = r;
       Model = m;
       View = v;
       View.Products = new Dictionary<string, ProductEntity>();
 }
示例#4
0
 public DealController(IDealRepository dealRepository, ITaskRepository taskRepository, IDealView dealView, INewDealView newDealView, ILoadingView loadingView)
 {
     this.dealView = dealView;
     this.newDealView = newDealView;
     this.loadingView = loadingView;
     this.taskRepository = taskRepository;
     this.dealRepository = dealRepository;
 }
示例#5
0
        public Task Load(ILoadingView view)
        {
            return(Task.Run(() => {
                try {
                    Program.Discord = new DiscordWrapper();

                    Program.Discord.Error += Discord_Error;
                } catch (Exception ex) {
                    Log.Warn($"Discord Creation Error: {ex.Message}", ex);
                }
            }));
        }
示例#6
0
        protected override async Task <Window> Load(ILoadingView loadingView)
        {
            try {
                var replayClient = new ReplayClient();
                Program.Client = replayClient;

                Program.IsHost = true;

                loadingView.UpdateStatus("Loading Replay..");
                ReplayReader reader = null;
                ReplayEngine engine = null;
                try {
                    reader = ReplayReader.FromStream(File.OpenRead(_replayPath));
                    engine = new ReplayEngine(reader, replayClient);

                    loadingView.UpdateStatus("Loading Game...");
                    var game = GameManager.Get().GetById(reader.Replay.GameId);

                    loadingView.UpdateStatus("Loading Game Engine...");
                    Program.CurrentOnlineGameName = game.Name;
                    Program.GameEngine            = new GameEngine(engine, game, reader.Replay.User);
                } catch {
                    reader?.Dispose();
                    engine?.Dispose();

                    throw;
                }

                var dispatcher = Dispatcher.CurrentDispatcher;

                Window window = null;
                await dispatcher.InvokeAsync(() => {
                    window = WindowManager.PlayWindow = new PlayWindow();

                    window.Closed += PlayWindow_Closed;

                    window.Show();
                }, DispatcherPriority.Background);

                return(window);
            } catch (UserMessageException) {
                throw;
            } catch (Exception e) {
                var msg = $"Error launching replay from {_replayPath}: {e.Message}";

                Log.Warn(msg, e);

                throw new UserMessageException(UserMessageExceptionMode.Blocking, msg, e);
            }
        }
示例#7
0
        protected override async Task <Window> Load(ILoadingView loadingView)
        {
            try {
                await new GameTableLauncher().Launch(this.hostPort, this.gameId);

                return(WindowManager.PlayWindow);
            } catch (Exception e) {
                var msg = "Couldn't host local game";

                Log.Warn(msg, e);

                throw new UserMessageException(UserMessageExceptionMode.Blocking, msg, e);
            }
        }
        private async UniTask <AsyncUnit> StartLoading(ILoadingView loadingView, List <ICommand> commands, CancellationToken cancellationToken)
        {
            Container.Rebind <ILoadingView>().FromInstance(loadingView).AsTransient();
            Container.Rebind <List <ICommand> >().FromInstance(commands).AsTransient();

            var viewManager = Container.Resolve <ILoadingViewManager>();

            //Here's a bit magic to unload from memory view
            Container.Unbind <ILoadingView>();
            Container.Unbind <List <ICommand> >();

            await viewManager.StartLoading(cancellationToken);

            return(AsyncUnit.Default);
        }
示例#9
0
    IEnumerator Start()
    {
        DontDestroyOnLoad(this.gameObject);
        mLoadingView = YarLiongFactory.GetLoadingView();
        mModel       = YarLiongFactory.MainGameModel;

        if (mLoadingView != null)
        {
            yield return(StartCoroutine(mLoadingView.Init()));
        }

        if (mSceneController != null)
        {
            yield return(StartCoroutine(mSceneController.Init()));
        }
    }
示例#10
0
        protected override async Task <Window> Load(ILoadingView loadingView)
        {
            try {
                var fn = Path.GetFileName(DeckPath);
                loadingView.UpdateStatus($"Loading Deck '{fn}'...");

                await Task.Run(() => {
                    Deck = (DeckPath == null) ? null : new MetaDeck(DeckPath);
                });

                Window win = null;
                await Dispatcher.CurrentDispatcher.InvokeAsync(() => {
                    win = new DeckBuilderWindow(Deck, true);

                    win.WindowStartupLocation = WindowStartupLocation.CenterScreen;

                    win.Show();
                }, DispatcherPriority.Background);

                return(win);
            } catch (Exception e) {
                string msg;
                if (string.IsNullOrWhiteSpace(DeckPath))
                {
                    msg = $"Deck editor failed to launch: {e.Message}";
                }
                else
                {
                    msg = $"Deck editor failed to launch '{DeckPath}': {e.Message}";
                }

                Log.Warn(msg, e);

                throw new UserMessageException(
                          UserMessageExceptionMode.Blocking,
                          msg,
                          e
                          );
            }
        }
示例#11
0
文件: Loader.cs 项目: llebel/OCTGN
        public async Task Load(ILoadingView view)
        {
            foreach (var loader in Loaders)
            {
                Log.Info($"Loading {loader.Name}");

                view.UpdateStatus($"Loading {loader.Name}");

                try {
                    await loader.Load(view);
                } catch (Exception ex) {
                    var msg = $"Error loading {loader.Name}: {ex.Message}";

                    Log.Error(msg, ex);

                    throw new UserMessageException(
                              UserMessageExceptionMode.Blocking,
                              msg,
                              ex
                              );
                }
            }
        }
示例#12
0
        public async Task <bool> Launch(ILoadingView view)
        {
            Dispatcher.CurrentDispatcher.VerifyAccess();

            view.UpdateStatus($"Launching {Name}...");

            var window = await Load(view);

            if (window == null)
            {
                Log.Warn("No window created");

                return(false);
            }

            // do async so can run in backround
            await Dispatcher.Yield(DispatcherPriority.Background);

            Application.Current.MainWindow = window;

            await Task.Delay(300);

            return(true);
        }
示例#13
0
 public Task Load(ILoadingView view)
 {
     return(Task.Run(LoadSync));
 }
示例#14
0
 public LoadingViewMediator(ILoadingView view) : base(view)
 {
     this.Target = view;
 }
 public ActionExecutor(ILoadingView loadingView, IMessageBoxPresenter messageBoxPresenter, IOptions <ActionExecutorOptions> options)
 {
     _loadingView         = loadingView ?? throw new ArgumentNullException(nameof(loadingView));
     _options             = options ?? throw new ArgumentNullException(nameof(options));
     _messageBoxPresenter = messageBoxPresenter ?? throw new ArgumentNullException(nameof(messageBoxPresenter));
 }
 public LoadingViewManager(ILoadingView loadingView, ILoadingManager loadingManager)
 {
     this.loadingView    = loadingView;
     this.loadingManager = loadingManager;
 }
示例#17
0
 private void CreateLoadingView()
 {
     loadingView = UICreator
                   .GetInstance()
                   .Create <LoadingText>(UICanvasLayer.Background, UIIndex.End);
 }
示例#18
0
 protected abstract Task <Window> Load(ILoadingView loadingView);
示例#19
0
 public TaskController(ITaskRepository taskRepository, ILoadingView loadingView, ITasksView tasksView)
 {
     this.taskRepository = taskRepository;
     this.loadingView = loadingView;
     this.tasksView = tasksView;
 }
示例#20
0
        protected override async Task <Window> Load(ILoadingView loadingView)
        {
            var hostedGame = _game;

            try {
                Program.CurrentHostedGame = hostedGame;
                var password = string.Empty;
                if (Program.IsHost = _isHost)
                {
                    password = hostedGame.Password;
                }
                else
                {
                    if (hostedGame.HasPassword)
                    {
                        var dlg = new InputDlg("Password", "Please enter this games password", "");

                        password = dlg.GetString();
                    }
                }

                if (hostedGame.Source == HostedGameSource.Online)
                {
                    Program.CurrentOnlineGameName = hostedGame.Name;
                }

                loadingView.UpdateStatus("Loading game");
                var gm = GameManager.Get();

                var game = GameManager.Get().GetById(hostedGame.GameId);

                if (game == null)
                {
                    var msg = $"Game {hostedGame.GameName}({hostedGame.Id}) could not be found.";
                    throw new UserMessageException(UserMessageExceptionMode.Blocking, msg);
                }

                loadingView.UpdateStatus("Building engine");
                Program.GameEngine = new GameEngine(game, _username, _spectate, password);

                loadingView.UpdateStatus($"Connecting to {hostedGame.HostAddress}");
                await Task.Delay(100);

                Program.Client = await Connect(hostedGame.Host, hostedGame.Port);

                if (Program.Client == null)
                {
                    var msg = $"Unable to connect to {hostedGame.Name} at {hostedGame.HostAddress}";

                    throw new UserMessageException(UserMessageExceptionMode.Blocking, msg);
                }

                Window window = null;
                await Dispatcher.CurrentDispatcher.InvokeAsync(() => {
                    window = WindowManager.PlayWindow = new PlayWindow();

                    window.Closed += PlayWindow_Closed;

                    window.Show();
                }, DispatcherPriority.Background);

                return(window);
            } catch (Exception e) {
                var msg = $"Error joining game {hostedGame.Name}: {e.Message}";

                Log.Warn(msg, e);

                throw new UserMessageException(UserMessageExceptionMode.Blocking, msg, e);
            }
        }
 public LoadingViewMediator(ILoadingView view)
     : base(view)
 {
     this.Target = view;
 }
示例#22
0
 public async Task Load(ILoadingView view)
 {
     await Task.Run(() => {
         LoadConfig();
     });
 }