Exemplo n.º 1
0
 /// <summary>
 /// handle resource checked
 /// </summary>
 /// <param name="checkStateChangedArgs"></param>
 void OnCheckedStateChangedAction(CheckStateChangedArgs checkStateChangedArgs)
 {
     if (checkStateChangedArgs != null && checkStateChangedArgs.PreviousState && checkStateChangedArgs.NewState == false)
     {
         if (Target != null)
         {
             if (checkStateChangedArgs.ResourceId != Guid.Empty)
             {
                 if (SelectedDestinationServer != null)
                 {
                     if (SelectedDestinationServer.ResourceRepository != null)
                     {
                         var resourceModel = SelectedDestinationServer.ResourceRepository.FindSingle(model => model.ID == checkStateChangedArgs.ResourceId) as IContextualResourceModel;
                         if (resourceModel != null)
                         {
                             Target.SetNodeOverwrite(resourceModel, false);
                         }
                     }
                 }
             }
         }
     }
     if (checkStateChangedArgs != null && checkStateChangedArgs.UpdateStats)
     {
         CalculateStats();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// handle resource checked
        /// </summary>
        /// <param name="checkStateChangedArgs"></param>
        void OnCheckedStateChangedAction(CheckStateChangedArgs checkStateChangedArgs)
        {
            if (checkStateChangedArgs != null && checkStateChangedArgs.PreviousState && checkStateChangedArgs.NewState == false)
            {
                if (Target != null)
                {
                    if (checkStateChangedArgs.ResourceId != Guid.Empty)
                    {
                        if (SelectedDestinationServer != null)
                        {
                            if (SelectedDestinationServer.ResourceRepository != null)
                            {
                                var resourceModel = SelectedDestinationServer.ResourceRepository.FindSingle(model => model.ID == checkStateChangedArgs.ResourceId) as IContextualResourceModel;
                                if (resourceModel != null)
                                {
                                    Target.SetNodeOverwrite(resourceModel, false);
                                }
                            }
                        }
                    }
                }
            }
            if (checkStateChangedArgs != null && checkStateChangedArgs.UpdateStats)
            {
                CalculateStats();
            }
            if (checkStateChangedArgs != null && checkStateChangedArgs.NewState && checkStateChangedArgs.PreviousState == false)
            {
                if (Source != null && Source.ExplorerItemModels.Any())
                {
                    IExplorerItemModel explorerItemModel = Source.ExplorerItemModels[0];

                    var items           = explorerItemModel.Descendants().Where(model => model.IsChecked.GetValueOrDefault(false) && model.ResourceId == checkStateChangedArgs.ResourceId).ToList();
                    var namingConflicts = _deployStatsCalculator.CheckForNamingConflicts(items, Target).ToList();
                    if (namingConflicts.Any())
                    {
                        StringBuilder message = new StringBuilder("The following items exist on the Destination Server with the same path and a different ID. Please rename, move or delete on the destination server before deploying:" + Environment.NewLine);
                        foreach (var namingConflict in namingConflicts)
                        {
                            message.AppendLine(namingConflict.ResourcePath);
                            namingConflict.IsChecked = false;
                        }

                        PopupController.Show(message.ToString(), "Resource Conflicts", MessageBoxButton.OK, MessageBoxImage.Error, null);
                    }
                }
            }
        }