예제 #1
0
        private void OnAddItemCommandClicked(ConfigurationDataItem dataItem)
        {
            var placedItem = _dataService.CopyConfigurationAndAddToList(dataItem, ConfigurationName);

            AddItemToSelectedCollection(placedItem);
            //TODO
            //Send Message to Unity - To spone item in to Scene
            SendUnityCommand();

            //Switch View to configuration if exists
            if (dataItem.IsConfigurationExist)
            {
                _navigationManager.GoToPage("Controllers", Enums.Pages.ConfigurationVm);
            }
        }
예제 #2
0
        private string CalculatedItemName(ConfigurationDataItem dataItem)
        {
            string calculatedName;

            if (_addedItemsDictionary.ContainsKey(dataItem.ItemName))
            {
                int numberOfShows = _addedItemsDictionary[dataItem.ItemName] + 1;
                calculatedName = dataItem.ItemName + numberOfShows;
                _addedItemsDictionary[dataItem.ItemName] = numberOfShows;
            }
            else
            {
                _addedItemsDictionary.Add(dataItem.ItemName, 0);
                calculatedName = dataItem.ItemName;
            }

            return(calculatedName);
        }
예제 #3
0
        //TODO add more functionality here

        public PlacedDataItem CopyConfigurationAndAddToList(ConfigurationDataItem dataItem, string configurationName)
        {
            var basePath  = _globalSettings.Get("BasePath").ToString();
            var itemsPath = _globalSettings.Get("ItemsPath").ToString();

            var    sourcePath      = Path.Combine(itemsPath, configurationName, dataItem.ItemName);
            var    calculatedName  = CalculatedItemName(dataItem);
            string destinationPath = "";

            if (FoldersHelper.CheckIfConfigFileExists(sourcePath))
            {
                destinationPath = Path.Combine(basePath, "Projects", ProjectsData.CurrentProjectName, ProjectsData.CurrentConfigurationName, "Configurations");

                FoldersHelper.CopyFileToLocation(Path.Combine(sourcePath, dataItem.ItemName + ".conf"), destinationPath, calculatedName + ".conf");
            }

            //return Placeid
            // AddItemToSelectedCollection(calculateditemName, destinationPath);
            return(new PlacedDataItem(calculatedName, destinationPath));
        }