private async Task LoadGroups()
        {
            var tries = 30;

            FaceGroups.Clear();

            while (tries-- > 0)
            {
                try
                {
                    var groups = await faceServiceClient.ListLargePersonGroupsAsync();

                    foreach (var grp in groups)
                    {
                        FaceGroups.Add(new LargePersonGroupExtended {
                            Group = grp
                        });
                    }
                    MainWindow.Log("Found {0} groups.", groups.Length);
                    break;
                }
                catch (Exception exc)
                {
                    MainWindow.Log($"Error loading groups: {exc.Message}. Retry in 1 second.");
                    await Task.Delay(1000);
                }
            }
            if (tries == 0)
            {
                MainWindow.Log($"Failed to load the groups after 30 tries.");
            }
        }
示例#2
0
        /// <summary>
        /// Loads the groups.
        /// </summary>
        /// <returns></returns>
        private async Task LoadGroups()
        {
            FaceGroups.Clear();

            var groups = await RetryHelper.OperationWithBasicRetryAsync(async() => await
                                                                        _faceServiceClient.ListLargePersonGroupsAsync(),
                                                                        new[] { typeof(FaceAPIException) },
                                                                        traceWriter : _mainWindowLogTraceWriter);

            foreach (var grp in groups)
            {
                FaceGroups.Add(new LargePersonGroupExtended {
                    Group = grp
                });
            }

            MainWindow.Log("Found {0} groups.", groups.Length);
        }
        /// <summary>
        /// Loads the groups.
        /// </summary>
        /// <returns></returns>
        private async Task LoadGroups()
        {
            FaceGroups.Clear();

            var groups = await RetryHelper.OperationWithBasicRetryAsync(async() => await
                                                                        _faceServiceClient.ListLargePersonGroupsAsync(),
                                                                        new[] { "RateLimitExceeded" },
                                                                        traceWriter : _mainWindowLogTraceWriter);

            foreach (var grp in groups)
            {
                FaceGroups.Add(new LargePersonGroupExtended {
                    Group = grp
                });
            }

            PropertyChanged(this, new PropertyChangedEventArgs("HasNoGroups"));
            MainWindow.Log("Found {0} groups.", groups.Length);
        }
示例#4
0
        public Geoset1300(BinaryReader br)
        {
            TotalSize = br.ReadUInt32();
            long end = TotalSize + br.BaseStream.Position;

            //Vertices
            if (br.HasTag("VRTX"))
            {
                NrOfVertices = br.ReadUInt32();
                for (int i = 0; i < NrOfVertices; i++)
                {
                    Vertices.Add(new CVector3(br));
                }
            }

            //Normals
            if (br.HasTag("NRMS"))
            {
                NrOfNormals = br.ReadUInt32();
                for (int i = 0; i < NrOfNormals; i++)
                {
                    Normals.Add(new CVector3(br));
                }
            }

            //TexCoords
            if (br.HasTag("UVAS"))
            {
                NrOfTexCoords = br.ReadUInt32();                 //Amount of groups
                for (int i = 0; i < NrOfNormals * NrOfTexCoords; i++)
                {
                    TexCoords.Add(new CVector2(br));
                }
            }

            //Face Group Type
            if (br.HasTag("PTYP"))
            {
                NrOfFaceTypeGroups = br.ReadUInt32();
                FaceTypes.AddRange(br.ReadBytes((int)NrOfFaceTypeGroups));
            }

            //Face Groups
            if (br.HasTag("PCNT"))
            {
                NrOfFaceGroups = br.ReadUInt32();
                for (int i = 0; i < NrOfFaceGroups; i++)
                {
                    FaceGroups.Add(br.ReadUInt32());
                }
            }

            //Indexes
            if (br.HasTag("PVTX"))
            {
                NrOfFaceVertices = br.ReadUInt32();
                for (int i = 0; i < NrOfFaceVertices / 3; i++)
                {
                    FaceVertices.Add(new CVertex(br));
                }
            }

            //Vertex Groups
            if (br.HasTag("GNDX"))
            {
                NrOfVertexGroupIndices = br.ReadUInt32();
                VertexGroupIndices.AddRange(br.ReadBytes((int)NrOfVertexGroupIndices));
            }

            //Matrix Groups
            if (br.HasTag("MTGC"))
            {
                NrOfMatrixGroups = br.ReadUInt32();
                for (int i = 0; i < NrOfMatrixGroups; i++)
                {
                    MatrixGroups.Add(br.ReadUInt32());
                }
            }

            //Matrix Indexes
            if (br.HasTag("MATS"))
            {
                NrOfMatrixIndexes = br.ReadUInt32();
                for (int i = 0; i < NrOfMatrixIndexes; i++)
                {
                    MatrixIndexes.Add(br.ReadUInt32());
                }
            }

            //Bone Indexes
            if (br.HasTag("BIDX"))
            {
                NrOfBoneIndexes = br.ReadUInt32();
                for (int i = 0; i < NrOfBoneIndexes; i++)
                {
                    BoneIndexes.Add(br.ReadUInt32());
                }
            }

            //Bone Weights
            if (br.HasTag("BWGT"))
            {
                NrOfBoneWeights = br.ReadUInt32();
                for (int i = 0; i < NrOfBoneWeights; i++)
                {
                    BoneWeights.Add(br.ReadUInt32());
                }
            }

            MaterialId     = br.ReadUInt32();
            SelectionGroup = br.ReadUInt32();
            Unselectable   = br.ReadUInt32() == 1;
            Bounds         = new CExtent(br);

            //Extents
            NrOfExtents = br.ReadUInt32();
            for (int i = 0; i < NrOfExtents; i++)
            {
                Extents.Add(new CExtent(br));
            }

            //Grouped Vertices
            for (int i = 0; i < NrOfVertices; i++)
            {
                if (!GroupedVertices.ContainsKey(VertexGroupIndices[i]))
                {
                    GroupedVertices.Add(VertexGroupIndices[i], new List <CVector3>());
                }

                GroupedVertices[VertexGroupIndices[i]].Add(Vertices[i]);
            }
        }