Exemplo n.º 1
0
 public NodeVM(IProjectClient client, FolderItem item)
 {
     this.Entity  = item;
     this.Name    = string.Format("{0}", item.Name);
     this.Details = string.Format("{0}", item.Size);
     this.LoadImageAsync(client);
 }
Exemplo n.º 2
0
        public ProjectMembersPage(IProjectClient client)
        {
            this.client = client;

            this.Title = "Members";

            this.RefreshAsync();

            this.Content = new ListView
            {
                ItemsSource = items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new TextCell();
                    cell.SetBinding <PersonVM>(TextCell.TextProperty, _ => _.FullName);
                    cell.SetBinding <PersonVM>(TextCell.DetailProperty, _ => _.Details);
                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
                RefreshCommand         = new Command(async() =>
                {
                    try
                    {
                        await this.RefreshAsync();
                    }
                    finally
                    {
                        ((ListView)this.Content).IsRefreshing = false;
                    }
                }),
            };
        }
Exemplo n.º 3
0
        public ProjectToDosPage(IProjectClient client)
        {
            this.client = client;

            this.Title = "ToDos";

            this.RefreshAsync();

            var listView = new ListView
            {
                ItemsSource = items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new TextCell();
                    cell.SetBinding <Todo>(TextCell.TextProperty, _ => _.Label);
                    cell.SetBinding <Todo>(TextCell.DetailProperty, _ => _.Description);
                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;
        }
Exemplo n.º 4
0
 private GitLabClient(string hostUrl, string apiToken)
 {
     _api = new API(hostUrl, apiToken);
     Users = new UserClient(_api);
     Projects = new ProjectClient(_api);
     Issues = new IssueClient(_api);
 }
        public GivenAnAssignmentClientInstance()
        {
            IApplicationContext  applicationContext  = new ApplicationContext();
            IConfigurationRoot   configurationRoot   = ConfigurationRootFactory.Create(applicationContext);
            IConfigurationGetter configurationGetter = new ConfigurationGetter(configurationRoot);

            var projectContextOptions = configurationGetter.GetOptions <ProjectContextOptions>();
            var clientOptions         = configurationGetter.GetOptions <CsomClientOptions>();

            var projectContext = ProjectContextFactory.Build(projectContextOptions);

            _projectClient  = new ProjectClient(projectContext, clientOptions);
            _taskClient     = new TaskClient(projectContext, clientOptions);
            _resourceClient = new EnterpriseResourceClient(projectContext, clientOptions);

            _client = new AssignmentClient(projectContext, clientOptions);

            _publishedProject = CreateTestProject().Result;
            _publishedTask    = CreateTestTask().Result;

            _enterpriseResource  = CreateTestResource().Result;
            _enterpriseResource2 = CreateTestResource().Result;

            _publishedProject = _projectClient.LinkToEnterpriseResources(_publishedProject, new [] { _enterpriseResource, _enterpriseResource2 }).Result;
        }
Exemplo n.º 6
0
        public ProjectDetailsPage(IProjectClient client, Project entity)
        {
            this.client = client;

            this.Title = "General";

            this.Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Padding = 20,
                    Spacing = 10,

                    Children =
                    {
                        new Image()
                        {
                            Source = ImageSource.FromStream(() => new ThumbnailImageSource(client).GetStream(entity.ThumbnailUrl).Result),
                            Aspect = Aspect.AspectFit,
                        },

                        new Label
                        {
                            Text = entity.Name,
                        },

                        new Label
                        {
                            Text = string.Format("Uri: {0}", client.ServiceUri.AbsoluteUri),
                        },

                        new Label
                        {
                            Text = string.Format("Location: {0}", entity.Location),
                        },

                        new Label
                        {
                            Text = string.Format("Size: {0}", entity.Size),
                        },

                        new Label
                        {
                            Text = string.Format("Created by '{0}' on {1}", entity.CreatedBy.Email, entity.CreatedOn.GetValueOrDefault()),
                        },

                        new Label
                        {
                            Text = string.Format("Modified by '{0}' on {1}", entity.ModifiedBy.Email, entity.ModifiedOn.GetValueOrDefault()),
                        },

                        new Label
                        {
                            Text = string.Format("Last visited on {0}", entity.LastVisited.GetValueOrDefault()),
                        },
                    }
                },
            };
        }
        private void InitializeFakeObjects()
        {
            _httpClientFactoryStub = new Mock <IHttpClientFactory>();
            var configurationClient = new ConfigurationClient(_httpClientFactoryStub.Object);

            _projectClient = new ProjectClient(configurationClient, new GetProjectOperation(_httpClientFactoryStub.Object),
                                               new DownloadProjectConfiguration(_httpClientFactoryStub.Object));
        }
Exemplo n.º 8
0
 private GitLabClient(string hostUrl, string apiToken)
 {
     _api     = new API(hostUrl, apiToken);
     Users    = new UserClient(_api);
     Projects = new ProjectClient(_api);
     Issues   = new IssueClient(_api);
     Groups   = new NamespaceClient(_api);
 }
Exemplo n.º 9
0
            public ViewVM(IProjectClient client, Trimble.Connect.Client.Models.View entity)
            {
                this.Entity      = entity;
                this.Name        = entity.Name;
                this.Description = entity.Description;

                this.LoadImageAsync(client);
            }
Exemplo n.º 10
0
 private async void LoadImageAsync(IProjectClient client)
 {
     if (this.Entity.ThumbnailUrl != null && this.Entity.ThumbnailUrl.StartsWith("http"))
     {
         ImageSource = ImageSource.FromStream(() => new ThumbnailImageSource(client).GetStream(this.Entity.ThumbnailUrl).Result);
         NotifyPropertyChanged("ImageSource");
     }
 }
Exemplo n.º 11
0
 GitLabClient(string hostUrl, string apiToken)
 {
     _api = new API(hostUrl, apiToken);
     Users = new UserClient(_api);
     Projects = new ProjectClient(_api);
     Issues = new IssueClient(_api);
     Groups = new NamespaceClient(_api);
 }
Exemplo n.º 12
0
 private GitLabClient(string hostUrl, string apiToken, IHttpRequestorFactory httpRequestorFactory)
 {
     _api     = new API(hostUrl, apiToken, httpRequestorFactory);
     Users    = new UserClient(_api);
     Projects = new ProjectClient(_api);
     Issues   = new IssueClient(_api);
     Groups   = new NamespaceClient(_api);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="projectClient">Drawboard project API client.</param>
 public ProjectListViewModel(IProjectClient projectClient)
 {
     if (null == projectClient)
     {
         throw new ArgumentNullException("projectClient");
     }
     _projectClient = projectClient;
 }
Exemplo n.º 14
0
 GitLabClient(string hostUrl, string apiToken, ApiVersion apiVersion)
 {
     api             = new Api(hostUrl, apiToken);
     api._ApiVersion = apiVersion;
     Users           = new UserClient(api);
     Projects        = new ProjectClient(api);
     Issues          = new IssueClient(api);
     Groups          = new NamespaceClient(api);
 }
Exemplo n.º 15
0
 private GitLabClient(string hostUrl, string apiToken, string accessToken)
 {
     _api = new API(hostUrl, apiToken, accessToken);
     Users = new UserClient(_api);
     Projects = new ProjectClient(_api);
     Issues = new IssueClient(_api);
     Groups = new NamespaceClient(_api);
     Labels = new LabelClient(_api);
 }
Exemplo n.º 16
0
 public NodeVM(IProjectClient client, int level, FolderItem item)
 {
     this.Item    = item;
     this.Name    = string.Format("{0}{1}", new string(' ', 4 * level), item.Name);
     this.Details = string.Format("{0}{1}", new string(' ', 4 * level), item.Size);
     if (this.Item.ThumbnailUrl != null && this.Item.ThumbnailUrl.StartsWith("http"))
     {
         this.ImageSource = ImageSource.FromStream(() => new ThumbnailImageSource(client).GetStream(this.Item.ThumbnailUrl).Result);
         this.NotifyPropertyChanged("ImageSource");
     }
 }
        public GivenAProjectClientInstance()
        {
            IApplicationContext  applicationContext  = new ApplicationContext();
            IConfigurationRoot   configurationRoot   = ConfigurationRootFactory.Create(applicationContext);
            IConfigurationGetter configurationGetter = new ConfigurationGetter(configurationRoot);

            var projectContextOptions = configurationGetter.GetOptions <ProjectContextOptions>();
            var clientOptions         = configurationGetter.GetOptions <CsomClientOptions>();

            _projectContext           = ProjectContextFactory.Build(projectContextOptions);
            _client                   = new ProjectClient(_projectContext, clientOptions);
            _enterpriseResourceClient = new EnterpriseResourceClient(_projectContext, clientOptions);
        }
Exemplo n.º 18
0
        public GivenATaskClientInstance()
        {
            IApplicationContext  applicationContext  = new ApplicationContext();
            IConfigurationRoot   configurationRoot   = ConfigurationRootFactory.Create(applicationContext);
            IConfigurationGetter configurationGetter = new ConfigurationGetter(configurationRoot);

            var projectContextOptions = configurationGetter.GetOptions <ProjectContextOptions>();
            var clientOptions         = configurationGetter.GetOptions <CsomClientOptions>();

            var projectContext = ProjectContextFactory.Build(projectContextOptions);

            _projectClient     = new ProjectClient(projectContext, clientOptions);
            _client            = new TaskClient(projectContext, clientOptions);
            _customFieldClient = new CustomFieldClient(projectContext, clientOptions);
            _entityTypeClient  = new EntityTypeClient(projectContext, clientOptions);

            _publishedProject = CreateTestProject().Result;
        }
Exemplo n.º 19
0
        public ProjectPage(IProjectClient client, Project entity)
        {
            this.client = client;
            this.entity = entity;

            this.ToolbarItems.Add(
                new ToolbarItem
            {
                Text    = "Stats",
                Command = new Command(() => this.Navigation.PushAsync(new StatsPage()))
            });

            this.Children.Add(new ProjectDetailsPage(client, entity));
            this.Children.Add(new ProjectMembersPage(client));
            this.Children.Add(new ProjectFilesPage(client, entity.RootFolderIdentifier));
            this.Children.Add(new ProjectToDosPage(client));
            this.Children.Add(new ProjectViewsPage(client));
        }
Exemplo n.º 20
0
        public ProjectFilesPage(IProjectClient client, string rootFolderId)
        {
            this.client       = client;
            this.rootFolderId = rootFolderId;

            this.Title = "Files";

            this.RefreshAsync();

            var listView = new ListView
            {
                ItemsSource = this.items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding <NodeVM>(TextCell.TextProperty, _ => _.Name);
                    cell.SetBinding <NodeVM>(TextCell.DetailProperty, _ => _.Details);
                    cell.SetBinding <NodeVM>(ImageCell.ImageSourceProperty, _ => _.ImageSource);

                    cell.Tapped += async delegate
                    {
                        var node = (NodeVM)cell.BindingContext;
                        await this.Navigation.PushAsync(new FilePage(client, node.Item));
                    };

                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;
        }
Exemplo n.º 21
0
 public DependantResourceHandler(
     IProjectClient projectClient,
     IMarkSessionRepository markSessionRepository,
     IMetadataClient metadataClient,
     IScenarioClient scenarioClient,
     IResultConfigClient resultConfigClient,
     ISimPlanClient simPlanClient,
     ISimRunClient simRunClient,
     IResultDataClient resultDataClient
     )
 {
     _projectClient         = projectClient;
     _markSessionRepository = markSessionRepository;
     _metadataClient        = metadataClient;
     _scenarioClient        = scenarioClient;
     _resultConfigClient    = resultConfigClient;
     _simPlanClient         = simPlanClient;
     _simRunClient          = simRunClient;
     _resultDataClient      = resultDataClient;
 }
Exemplo n.º 22
0
            private async void LoadImageAsync(IProjectClient client)
            {
                if (string.IsNullOrEmpty(this.Entity.ParentVersionIdentifier))
                {
                    return;
                }

                try
                {
                    var info = await client.Files.GetFileInfoAsync(this.Entity.Identifier).ConfigureAwait(false);

                    if (info.ThumbnailUrl != null && info.ThumbnailUrl.StartsWith("http"))
                    {
                        ImageSource = ImageSource.FromStream(() => new ThumbnailImageSource(client).GetStream(info.ThumbnailUrl).Result);
                        NotifyPropertyChanged("ImageSource");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
Exemplo n.º 23
0
        public FileHistoryPage(IProjectClient client, FolderItem item)
        {
            this.client = client;
            this.item   = item;

            this.Title = "History";

            this.RefreshAsync();

            var listView = new ListView
            {
                ItemsSource = items,

                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new ImageCell();
                    cell.SetBinding <NodeVM>(TextCell.TextProperty, _ => _.Name);
                    cell.SetBinding <NodeVM>(TextCell.DetailProperty, _ => _.Details);
                    cell.SetBinding <NodeVM>(ImageCell.ImageSourceProperty, _ => _.ImageSource);
                    return(cell);
                }),
                IsPullToRefreshEnabled = true,
            };

            listView.RefreshCommand = new Command(async() =>
            {
                try
                {
                    await this.RefreshAsync();
                }
                finally
                {
                    listView.IsRefreshing = false;
                }
            });
            this.Content = listView;
        }
 public ModuleFeedClient(IProjectClient projectClient, IConfigurationClient configurationClient)
 {
     _projectClient       = projectClient;
     _configurationClient = configurationClient;
 }
 public AllocationController(IAllocationDataGateway gateway, IProjectClient client)
 {
     _gateway = gateway;
     _client  = client;
 }
Exemplo n.º 26
0
 public ProjectsTests()
 {
     projects = Config.Connect().Projects;
     CreateProject(out created, "default-project-tests", false);
 }
Exemplo n.º 27
0
 public ThumbnailImageSource(IProjectClient client)
 {
     this.client         = client;
     this.CachingEnabled = false;
     this.CacheValidity  = TimeSpan.FromDays(1);
 }
Exemplo n.º 28
0
        public FileDetailsPage(IProjectClient client, FolderItem item)
        {
            this.client = client;
            this.item   = item;

            this.Title = "File Details";

            Entry format;

            this.Content = new StackLayout
            {
                Padding = 20,
                Spacing = 20,

                Children =
                {
                    new Image()
                    {
                        Source = ImageSource.FromStream(() => new ThumbnailImageSource(client).GetStream(this.item.ThumbnailUrl).Result),
                        Aspect = Aspect.AspectFit,
                    },

                    new Label
                    {
                        Text = item.Name,
                        HorizontalOptions = LayoutOptions.Center,
                    },

                    new Label
                    {
                        Text = string.Format("Size={0}", item.Size),
                        HorizontalOptions = LayoutOptions.Center,
                    },

                    (format = new Entry
                    {
                        Placeholder = "format",
                        Keyboard = Keyboard.Email,
                    }),

                    new Button
                    {
                        Text    = "Download",
                        Command = new Command(async() =>
                        {
                            await this.Download(format.Text);
                        })
                    },

                    (this.progressBar = new ProgressBar
                    {
                    }),

                    (this.stat = new Label
                    {
                        Text = string.Empty,
                        HorizontalOptions = LayoutOptions.Center,
                    }),
                }
            };
        }
Exemplo n.º 29
0
 public ProjectsTests()
 {
     _projects = Config.Connect().Projects;
     CreateProject(out _created, "default");
 }
Exemplo n.º 30
0
 public StoryController(IStoryDataGateway gateway, IProjectClient client)
 {
     _gateway = gateway;
     _client  = client;
 }
Exemplo n.º 31
0
 public ProjectHooksClientTests()
 {
     projects = Config.Connect().Projects;
 }
Exemplo n.º 32
0
 public TimeEntryController(ITimeEntryDataGateway gateway, IProjectClient client)
 {
     _gateway = gateway;
     _client  = client;
 }
Exemplo n.º 33
0
 public ProjectsTests()
 {
     _projects = Config.Connect().Projects;
     CreateProject(out _created, "default");
 }
Exemplo n.º 34
0
 public FilePage(IProjectClient client, FolderItem item)
 {
     this.client = client;
     Children.Add(new FileDetailsPage(client, item));
     Children.Add(new FileHistoryPage(client, item));
 }