public static bool IfUriExists(Uri uri, Label label)
 {
     var uriExists = new TargetsBridge(new SettingsWrapper()).ValidateTargetUriExists(uri);
     label.Content = uriExists ?
         Properties.Resources.TargetDuplicateUri : Properties.Resources.TargetUri;
     return uriExists;
 }
Exemplo n.º 2
0
 private void TileOnClick(object sender, RoutedEventArgs routedEventArgs)
 {
     var tile = routedEventArgs.Source as Tile;
     var target = new TargetsBridge(new SettingsWrapper()).GetTarget(tile.Title);
     new SettingsWrapper().SetActiveFoundryTarget(target);
     NavigationCloudsHelper.LoadDetailView(ParentCloudsView.CloudsViewInteractiveStackPanel);
 }
 public static bool IfNameExists(string name, Label label)
 {
     var nameExists = new TargetsBridge(new SettingsWrapper()).ValidateTargetNameExists(name);
     label.Content = nameExists ?
         Properties.Resources.TargetDuplicateName : Properties.Resources.TargetName;
     return nameExists;
 }
Exemplo n.º 4
0
        private void RefreshTargetTiles()
        {
            var tiles = new List<Tile>();
            var targets = new TargetsBridge(new SettingsWrapper()).GetTargets();

            CloudsViewStackPanel.Children.RemoveRange(1, CloudsViewStackPanel.Children.Count - 1);
            foreach (var target in targets)
            {
                var cloudTile = new CloudTile {CloudTarget = {Title = target.Name}};
                
                if(target.Applications != null)
                {
                    var apps = target.Applications as List<object>;
                    if (apps != null && apps.Count > 0)
                    {
                        cloudTile.Applications.Text = apps.Count.ToString(CultureInfo.InvariantCulture);
                        cloudTile.Apps.Text = "Apps";
                    }
                }

                cloudTile.CloudTarget.Click += TileOnClick;
                CloudsViewStackPanel.Children.Add(cloudTile);
                tiles.Add(cloudTile.CloudTarget);
            }

            Tiles = tiles;
        }
        public void where_target()
        {
            // this is done in another part of the application, but is done here for testing specifically.
            StaticTestData.MakeSureSettingsJsonFoundryExists();

            _wrapper = Substitute.For<ICuzSettingsIsSealedWrapper>();

            targetsBridge = new TargetsBridge(_wrapper);
            target = StaticTestData.SampleFoundryTarget();

            _wrapper.Get().Returns((new Foundry()));
        }
        public static bool IfUriExists(string uri, Label label)
        {
            if(string.IsNullOrWhiteSpace(uri))
            {
                label.Content = Properties.Resources.TargetUri;
                return false;
            }

            var uriExists = new TargetsBridge(new SettingsWrapper()).ValidateTargetUriExists(new Uri(uri));
            label.Content = uriExists ?
                Properties.Resources.TargetDuplicateUri : Properties.Resources.TargetUri;
            return uriExists;
        }
Exemplo n.º 7
0
        private void AddCloudButtonClick(object sender, RoutedEventArgs e)
        {
var targetRepository = new TargetsBridge(new SettingsWrapper());

            if (!NavigationCloudsHelper.IfNameExists(TargetNameTextBox.Text, TargetNameLabel) &&
                !NavigationCloudsHelper.IfUriExists(TargetUriTextBox.Text, TargetUriLabel))
            {
                var foundryTarget = new FoundryTarget()
                {
                    Created = DateTime.Now,
                    Name = TargetNameTextBox.Text,
                    Username = UsernameTextBox.Text,
                    Password = PasswordTextBox.Password,
                    Path = new Uri(TargetUriTextBox.Text),
                    Stamp = DateTime.Now
                };

                targetRepository.PutTarget(foundryTarget);
                ClearCloudsAddViewForm();

                NavigationCloudsHelper.LoadListView(ParentCloudsView.CloudsViewInteractiveStackPanel);
            }
        }
        private void SaveCloudTarget()
        {
            var foundryTarget = new FoundryTarget()
            {
                Created = DateTime.Now,
                Name = TargetNameTextBox.Text,
                Username = UsernameTextBox.Text,
                Password = PasswordTextBox.Password,
                Path = new Uri(TargetUriTextBox.Text),
                Stamp = DateTime.Now
            };

            var targetRepository = new TargetsBridge(new SettingsWrapper());

            if (!NavigationCloudsHelper.IfNameExists(TargetNameTextBox.Text, TargetNameLabel) &&
                !NavigationCloudsHelper.IfUriExists(TargetUriTextBox.Text, TargetUriLabel))
            {
                targetRepository.DeleteTarget(_tempFoundryTarget);
                targetRepository.PutTarget(foundryTarget);
                NavigationCloudsHelper.LoadListView(ParentCloudsView.CloudsViewInteractiveStackPanel);
            }
        }