コード例 #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);
 }
コード例 #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;
                    }
                }),
            };
        }
コード例 #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;
        }
コード例 #4
0
ファイル: GitLabClient.cs プロジェクト: rafaltra/NGitLab
 private GitLabClient(string hostUrl, string apiToken)
 {
     _api = new API(hostUrl, apiToken);
     Users = new UserClient(_api);
     Projects = new ProjectClient(_api);
     Issues = new IssueClient(_api);
 }
コード例 #5
0
        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;
        }
コード例 #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()),
                        },
                    }
                },
            };
        }
コード例 #7
0
        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));
        }
コード例 #8
0
ファイル: GitLabClient.cs プロジェクト: shivan/NGitLab
 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);
 }
コード例 #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);
            }
コード例 #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");
     }
 }
コード例 #11
0
ファイル: GitLabClient.cs プロジェクト: Xarlot/NGitLab
 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);
 }
コード例 #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);
 }
コード例 #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;
 }
コード例 #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);
 }
コード例 #15
0
ファイル: GitLabClient.cs プロジェクト: antonioseric/NGitLab
 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);
 }
コード例 #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");
     }
 }
コード例 #17
0
        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);
        }
コード例 #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;
        }
コード例 #19
0
ファイル: ProjectPage.cs プロジェクト: yongchaowu/samples
        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));
        }
コード例 #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;
        }
コード例 #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;
 }
コード例 #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());
                }
            }
コード例 #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;
        }
コード例 #24
0
 public ModuleFeedClient(IProjectClient projectClient, IConfigurationClient configurationClient)
 {
     _projectClient       = projectClient;
     _configurationClient = configurationClient;
 }
コード例 #25
0
 public AllocationController(IAllocationDataGateway gateway, IProjectClient client)
 {
     _gateway = gateway;
     _client  = client;
 }
コード例 #26
0
 public ProjectsTests()
 {
     projects = Config.Connect().Projects;
     CreateProject(out created, "default-project-tests", false);
 }
コード例 #27
0
 public ThumbnailImageSource(IProjectClient client)
 {
     this.client         = client;
     this.CachingEnabled = false;
     this.CacheValidity  = TimeSpan.FromDays(1);
 }
コード例 #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,
                    }),
                }
            };
        }
コード例 #29
0
 public ProjectsTests()
 {
     _projects = Config.Connect().Projects;
     CreateProject(out _created, "default");
 }
コード例 #30
0
 public StoryController(IStoryDataGateway gateway, IProjectClient client)
 {
     _gateway = gateway;
     _client  = client;
 }
コード例 #31
0
 public ProjectHooksClientTests()
 {
     projects = Config.Connect().Projects;
 }
コード例 #32
0
 public TimeEntryController(ITimeEntryDataGateway gateway, IProjectClient client)
 {
     _gateway = gateway;
     _client  = client;
 }
コード例 #33
0
ファイル: ProjectsTests.cs プロジェクト: Xarlot/NGitLab
 public ProjectsTests()
 {
     _projects = Config.Connect().Projects;
     CreateProject(out _created, "default");
 }
コード例 #34
0
ファイル: FilePage.cs プロジェクト: yongchaowu/samples
 public FilePage(IProjectClient client, FolderItem item)
 {
     this.client = client;
     Children.Add(new FileDetailsPage(client, item));
     Children.Add(new FileHistoryPage(client, item));
 }