/// ------------------------------------------------------------------------------------
        public void AddRowGroup(string text, int rowCount, string textsLocalizationId)
        {
            var grp = CVChartRowGroup.Create(text, rowCount, this, textsLocalizationId);

            RowHeadersWidth = Math.Max(RowHeadersWidth, grp.PreferredWidth);
            RowGroups.Add(grp);
        }
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        #region Public Methods

        /// <summary>
        /// <see cref="IAddChild.AddChild"/>
        /// </summary>
        void IAddChild.AddChild(object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            TableRowGroup rowGroup = value as TableRowGroup;

            if (rowGroup != null)
            {
                RowGroups.Add(rowGroup);
                return;
            }

            throw (new ArgumentException(SR.Get(SRID.UnexpectedParameterType, value.GetType(), typeof(TableRowGroup)), "value"));
        }
Beispiel #3
0
        private void UpdateContent()
        {
            RowGroups.Clear();

            if (HeaderRowGroup != null)
            {
                RowGroups.Add(HeaderRowGroup);
            }

            if (ItemsSource != null)
            {
                if (ItemTemplate == null)
                {
                    throw new InvalidOperationException("When ItemsSource is used then the ItemTemplate must not be null.");
                }

                TableRowGroup contentRowGroup = new TableRowGroup();
                foreach (object item in ItemsSource)
                {
                    TableRow       tableRow       = null;
                    ContentElement contentElement = ItemTemplate.LoadContent() as ContentElement;
                    if (contentElement != null)
                    {
                        tableRow = contentElement.Content as TableRow;
                    }

                    if (tableRow == null)
                    {
                        throw new InvalidOperationException("The ItemTemplate must define: DataTemplate > ContentElement > TableRow.");
                    }
                    tableRow.DataContext = item;
                    contentRowGroup.Rows.Add(tableRow);
                }

                if (contentRowGroup.Rows.Any())
                {
                    RowGroups.Add(contentRowGroup);
                }
            }

            if (FooterRowGroup != null)
            {
                RowGroups.Add(FooterRowGroup);
            }
        }
        public int[] DispatchRowGroupsToClients(string clientSender)
        {
            this.clientSender = clientSender;
            //totalRows = rowsNumber;
            if (totalRows <= 0)
                return null;
            assignedRowsGroups = new Dictionary<string, RowGroups>();
            int clientsNumber = clients.Count;
            int groups = totalRows / clientsNumber;
            int row = 0;
            foreach (string client in clients)
            {
                RowGroups groupForClient = new RowGroups();
                for (int i = 0; i < groups; i++)
                    groupForClient.Add(row++);
                assignedRowsGroups.Add(client, groupForClient);
            }
            while(row < totalRows)
            {
                assignedRowsGroups[clients[0]].Add(row++);
            }

            downloaded = 1; //clientSender has already downloaded its rows
            downloadedRows_m2[clientSender] = totalRows;
            lock(callingClientsLock)
            {
                callingClients = true;
            }
            foreach( int rowIndex in assignedRowsGroups[clientSender].rowGroups)
            {
                sourceMatrix_1[rowIndex].sent = true;
                assignedRowsGroups[clientSender].downloadedRows++;
            }
            return assignedRowsGroups[clientSender].rowGroups.ToArray();
        }