コード例 #1
0
        private async Task <ServiceViewModel> LoadService(Service service)
        {
            var versions = await _dataSource.Value.GetVersionListAsync(service.Id);

            var versionModels = versions
                                .Select(x => new VersionViewModel(this, service, x, isLastVersion: versions.Count == 1))
                                .OrderByDescending(x => GaeServiceExtensions.GetTrafficAllocation(service, x.Version.Id))
                                .ToList();

            return(new ServiceViewModel(this, service, versionModels));
        }
コード例 #2
0
        public VersionViewModel(
            GaeSourceRootViewModel owner,
            Service service,
            Google.Apis.Appengine.v1.Data.Version version,
            bool isLastVersion)
        {
            _owner             = owner;
            _service           = service;
            _version           = version;
            _trafficAllocation = GaeServiceExtensions.GetTrafficAllocation(_service, _version.Id);
            _isLastVersion     = isLastVersion;

            // Update the view.
            Caption = GetCaption();
            UpdateIcon();
            UpdateMenu();
        }
コード例 #3
0
        private void Initialize()
        {
            // Get the traffic allocation for the version
            TrafficAllocation = GaeServiceExtensions.GetTrafficAllocation(_owner.Service, version.Id);

            // Reset the resources loaded and clear any children.
            _resourcesLoaded = false;
            Children.Clear();

            // If the version is serving allow instances to be loaded.
            if (version.IsServing())
            {
                Children.Add(s_loadingPlaceholder);
            }

            // Update the view.
            Caption = GetCaption();
            UpdateIcon();
            UpdateMenu();
        }