public void DeleteVersionCommand(IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IExplorerTreeItem parent, string resourceName)
        {
            if (_popupController.ShowDeleteVersionMessage(resourceName) == MessageBoxResult.Yes)
            {
                explorerRepository.TryDelete(explorerItemViewModel);
                var parentChildren = new ObservableCollection <IExplorerItemViewModel>(parent.Children);

                var index = 0;
                for (var i = 0; i < parentChildren.Count; i++)
                {
                    if (parentChildren[i].ResourceName == resourceName)
                    {
                        index = i;
                        break;
                    }
                }

                parentChildren.RemoveAt(index);
                parent.Children = new ObservableCollection <IExplorerItemViewModel>(parentChildren);
                if (parent.ChildrenCount == 0)
                {
                    parent.AreVersionsVisible = true;
                }
                if (parentChildren.Count == 0)
                {
                    parent.AreVersionsVisible = false;
                    parent.IsMergeVisible     = false;
                }
                _shellViewModel.UpdateExplorerWorkflowChanges(explorerItemViewModel.ResourceId);
            }
        }
 public void DeleteCommand(IExplorerTreeItem parent, IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IPopupController popupController, IServer server)
 {
     try
     {
         if (explorerItemViewModel.IsResourceVersion)
         {
             DeleteVersionCommand(explorerRepository, explorerItemViewModel, parent, explorerItemViewModel.ResourceName);
         }
         else
         {
             var messageBoxResult = popupController.Show(popupController.GetDeleteConfirmation(explorerItemViewModel.ResourceName));
             if (server != null && messageBoxResult == MessageBoxResult.Yes)
             {
                 _shellViewModel.CloseResource(explorerItemViewModel.ResourceId, server.EnvironmentID);
                 var deletedFileMetadata = explorerRepository.Delete(explorerItemViewModel);
                 if (deletedFileMetadata.IsDeleted)
                 {
                     if (explorerItemViewModel.ResourceType == @"ServerSource" || explorerItemViewModel.IsServer)
                     {
                         server.UpdateRepository.FireServerSaved(explorerItemViewModel.ResourceId, true);
                     }
                     parent?.RemoveChild(explorerItemViewModel);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         explorerItemViewModel.ShowErrorMessage(ex.Message, @"Delete not allowed");
     }
 }
 public TeamOfExplorersService(ITeamOfExplorersRepository repository,
                               ITeamOfExplorersValidator teamOfExplorersValidator, IShuttleRepository shuttleRepository, IExplorerRepository explorerRepository)
 {
     _repository = repository;
     _teamOfExplorersValidator = teamOfExplorersValidator;
     _shuttleRepository        = shuttleRepository;
     _explorerRepository       = explorerRepository;
 }
 public HumanCaptainService(IHumanCaptainRepository repository, IHumanCaptainValidator humanCaptainValidator,
                            ITeamOfExplorersRepository teamOfExplorersRepository, IShuttleRepository shuttleRepository, IExplorerRepository explorerRepository)
 {
     _repository                = repository;
     _humanCaptainValidator     = humanCaptainValidator;
     _teamOfExplorersRepository = teamOfExplorersRepository;
     _shuttleRepository         = shuttleRepository;
     _explorerRepository        = explorerRepository;
 }
Beispiel #5
0
 public ApiDatabaseCachingProcessor(
     ICurrencyProvider iCurrencyProvider,
     IExplorerRepository iCurrencyRepository,
     ICollection <DayOfWeek> weekends)
     : this(iCurrencyProvider, iCurrencyRepository)
 {
     // Override weekends.
     _weekends = weekends;
 }
Beispiel #6
0
 public RobotService(IRobotRepository repository, IRobotValidator robotValidator,
                     ITeamOfExplorersRepository teamOfExplorersRepository, IShuttleRepository shuttleRepository,
                     IExplorerRepository explorerRepository, IHttpClientFactory clientFactory)
 {
     _repository                = repository;
     _robotValidator            = robotValidator;
     _teamOfExplorersRepository = teamOfExplorersRepository;
     _shuttleRepository         = shuttleRepository;
     _explorerRepository        = explorerRepository;
     _clientFactory             = clientFactory;
 }
 void DeleteIfAllowed(IExplorerTreeItem parent, IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IPopupController popupController, IServer server)
 {
     if (explorerItemViewModel.IsResourceVersion)
     {
         DeleteVersionCommand(explorerRepository, explorerItemViewModel, parent, explorerItemViewModel.ResourceName);
     }
     else
     {
         DeleteCommand(parent, explorerRepository, explorerItemViewModel, popupController, server);
     }
 }
 public void TryDeleteCommand(IExplorerTreeItem parent, IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IPopupController popupController, IServer server)
 {
     try
     {
         DeleteIfAllowed(parent, explorerRepository, explorerItemViewModel, popupController, server);
     }
     catch (Exception ex)
     {
         explorerItemViewModel.ShowErrorMessage(ex.Message, @"Delete not allowed");
     }
 }
        public void RollbackCommand(IExplorerRepository explorerRepository, IExplorerTreeItem parent, Guid resourceId, string versionNumber)
        {
            var output = explorerRepository.Rollback(resourceId, versionNumber);

            parent.AreVersionsVisible = true;
            parent.ResourceName       = output.DisplayName;
            if (parent.Server != null)
            {
                _shellViewModel.CloseResource(resourceId, parent.Server.EnvironmentID);
                _shellViewModel.OpenCurrentVersion(resourceId, parent.Server.EnvironmentID);
            }
        }
Beispiel #10
0
        void Initialize(Guid id, IEnvironmentConnection environmentConnection, IResourceRepository resourceRepository)
        {
            VerifyArgument.IsNotNull("environmentConnection", environmentConnection);
            CanStudioExecute   = true;
            EnvironmentID      = id;
            Connection         = environmentConnection;
            ResourceRepository = resourceRepository ?? new ResourceRepository(this);
            var communicationControllerFactory = new CommunicationControllerFactory();

            _proxyLayer      = new StudioServerProxy(communicationControllerFactory, Connection);
            UpdateRepository = new StudioResourceUpdateManager(communicationControllerFactory, Connection);
            Connection.PermissionsModified    += RaisePermissionsModifiedEvent;
            Connection.NetworkStateChanged    += RaiseNetworkStateChangeEvent;
            Connection.ItemAddedMessageAction += ItemAdded;
        }
Beispiel #11
0
        public ApiDatabaseCachingProcessor(
            ICurrencyProvider iCurrencyProvider,
            IExplorerRepository iCurrencyRepository)
        {
            _currencyProvider   = iCurrencyProvider;
            _currencyRepository = iCurrencyRepository;

            _weekends = new List <DayOfWeek>()
            {
                DayOfWeek.Sunday, DayOfWeek.Saturday
            };

            Data = null;

            var allCodes = RequestAllCurrencyCodes();
            //CurrencyRepository.AddCodeEntries(allCodes);
        }
        void DeleteCommand(IExplorerTreeItem parent, IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IPopupController popupController, IServer server)
        {
            var messageBoxResult = popupController.Show(popupController.GetDeleteConfirmation(explorerItemViewModel.ResourceName));

            if (server != null && messageBoxResult == MessageBoxResult.Yes)
            {
                _shellViewModel.CloseResource(explorerItemViewModel.ResourceId, server.EnvironmentID);
                var deletedFileMetadata = explorerRepository.TryDelete(explorerItemViewModel);
                if (deletedFileMetadata.IsDeleted)
                {
                    if (explorerItemViewModel.ResourceType == @"ServerSource" || explorerItemViewModel.IsServer)
                    {
                        server.UpdateRepository.FireServerSaved(explorerItemViewModel.ResourceId, true);
                    }
                    parent?.RemoveChild(explorerItemViewModel);
                }
            }
        }
        public void DeleteVersionCommand(IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IExplorerTreeItem parent, string resourceName)
        {
            if (_popupController.ShowDeleteVersionMessage(resourceName) == MessageBoxResult.Yes)
            {
                explorerRepository.Delete(explorerItemViewModel);
                var parentChildren = new ObservableCollection <IExplorerItemViewModel>(parent.Children);

                var index = 0;
                for (var i = 0; i < parentChildren.Count; i++)
                {
                    if (parentChildren[i].ResourceName == resourceName)
                    {
                        index = i;
                        break;
                    }
                }

                parentChildren.RemoveAt(index);
                parent.Children = new ObservableCollection <IExplorerItemViewModel>(parentChildren);
            }
        }
Beispiel #14
0
        public CurrencyXplorer(IApplicationEnvironment appEnv) : this()
        {
            //Configuration = Utils.CreateConfiguration(appEnv, "config.json");

            // Entry point for dependency injection.

            _iCurrencyImporter = new JsonCurrencyImporter();
            //_iCurrencyImporter = new LocalJsonCurrencyImporter(); ;

            _iCurrencyProvider = new NationalBankCurrencyProvider(_iCurrencyImporter);

            _currencyDataContext = new CurrencyDataContext(Configuration["Data:DefaultConnection:ConnectionString"]);
            _iCurrencyRepository = new MsSqlExplorerRepository(_currencyDataContext);

            _iCachingProcessor = new ApiDatabaseCachingProcessor(_iCurrencyProvider, _iCurrencyRepository);

            _iUserSettingsHolder = new UserSettingsHolder(_iCurrencyRepository);

            _dataPresenter = new DataPresenter();
            //_dataHolder = new DataHolder(_iCachingProcessor, _iUserSettingsHolder, Configuration);
            _dataProcessor = new DataProcessor(_iCachingProcessor);

            _allCurrencyCodes = GetAllCurrencyCodes();
        }
 public ExplorerDeleteProvider(IExplorerRepository repository)
 {
     _repository = repository;
 }
Beispiel #16
0
 public UserSettingsHolder(IExplorerRepository _explorerRepository)
 {
     ExplorerRepository = _explorerRepository;
 }
Beispiel #17
0
 public LocationController(IExplorerRepository repo)
 {
     _repo = repo;
 }