Inheritance: System.Windows.Forms.DataGridViewCell
コード例 #1
0
ファイル: FrmHome.cs プロジェクト: abduwaris/NewsGet
        void BindToDgv(INewsBase news, int typeID, int pageIndex = 1)
        {
            dgv.Rows.Clear();
            if (news != null)
            {
                var newsList = news.GetNewsList(typeID, pageIndex);
                if (newsList == null || newsList.Count <= 0) return;
                foreach (var item in newsList)
                {
                    int index = dgv.Rows.Add();
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    cell.Value = item.ID;
                    dgv.Rows[index].Cells["ID"] = cell;

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = item.Title;
                    dgv.Rows[index].Cells["Title"] = cell;

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = item.Source;
                    dgv.Rows[index].Cells["Source"] = cell;

                    DataGridViewButtonCell cellb = new DataGridViewButtonCell();
                    cellb.Value = item.IsGetted ? "تامام" : "يىغىش";
                    dgv.Rows[index].Cells["Make"] = cellb;

                    dgv.Rows[index].Tag = item;
                    if (item.IsGetted)
                    {
                        dgv.Rows[index].DefaultCellStyle = new DataGridViewCellStyle() { ForeColor = Color.Gray };
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: xSplit/YoutubeBOT
        void AddAccount(YTAccount account)
        {
            var actButton = new System.Windows.Forms.DataGridViewButtonCell();

            actButton.FlatStyle = FlatStyle.Flat;
            actButton.Value     = "Manage";
            actButton.Tag       = account.id;
            dataGridView1.Rows.Add(account.username + ' ' + account.surname, account.email, account.proxy != null?account.proxy[0] + ':' + account.proxy[1]:"", account.status, FilterAgent(account.agent));
            dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[5] = actButton;
            accounts.Add(account);
        }
コード例 #3
0
 private void AddGenerationParameterAsButton(String g, String v)
 {
     DataGridViewRow r = new DataGridViewRow();
     DataGridViewCell rColumn1 = new DataGridViewTextBoxCell();
     DataGridViewCell rColumn2 = new DataGridViewButtonCell();
     rColumn1.Value = g;
     rColumn2.Value = v;
     r.Cells.Add(rColumn1);
     r.Cells.Add(rColumn2);
     generationParametersTable.Rows.Add(r);
 }
コード例 #4
0
        public void ButtonTest()
        {
            SWF.DataGridViewButtonColumn column = new SWF.DataGridViewButtonColumn();
            column.HeaderText = "Button Column";

            SWF.DataGridViewButtonCell cell = new SWF.DataGridViewButtonCell();
            cell.Value = "Button cell 1";

            SWF.DataGridViewButtonCell cell1 = new SWF.DataGridViewButtonCell();
            cell1.Value = "Button cell 2";

            ColumnCellTest(column, cell, false, cell1);
        }
コード例 #5
0
		public void ButtonTest ()
		{
			SWF.DataGridViewButtonColumn column = new SWF.DataGridViewButtonColumn ();
			column.HeaderText = "Button Column";
			
			SWF.DataGridViewButtonCell cell = new SWF.DataGridViewButtonCell ();
			cell.Value = "Button cell 1";

			SWF.DataGridViewButtonCell cell1 = new SWF.DataGridViewButtonCell ();
			cell1.Value = "Button cell 2";
			
			ColumnCellTest (column, cell, false, cell1);
		}
コード例 #6
0
ファイル: ChekItemForm.cs プロジェクト: nburd/economy
 private void UpdateDataGrid()
 {
     chekItemDataGridView.Rows.Clear();
     var chekItems = db.Purchases.Find(IdPurchase).ChekItems.ToList();
     var renameButton = new DataGridViewButtonCell();
     var removeButton = new DataGridViewButtonCell();
     foreach (var chekItem in chekItems)
         chekItemDataGridView.Rows.Add(
             chekItem.Id, 
             chekItem.GoodsItem.Category.Name, 
             chekItem.GoodsItem.Name, 
             chekItem.Price, 
             chekItem.Quantity, 
             renameButton, 
             removeButton
             );
 }
 public override object Clone()
 {
     DataGridViewButtonCell cell;
     System.Type type = base.GetType();
     if (type == cellType)
     {
         cell = new DataGridViewButtonCell();
     }
     else
     {
         cell = (DataGridViewButtonCell) Activator.CreateInstance(type);
     }
     base.CloneInternal(cell);
     cell.FlatStyleInternal = this.FlatStyle;
     cell.UseColumnTextForButtonValueInternal = this.UseColumnTextForButtonValue;
     return cell;
 }
コード例 #8
0
 private void InitDataTable()
 {
     playerDataGrid.AutoGenerateColumns = false;
     playerDataGrid.Rows.Clear();
     foreach (var player in Settings.Settings.GetPlayers())
     {
         string username = player.ToString();
         int score = player.GetScore();
         DataGridViewRow row = new DataGridViewRow();
         DataGridViewCell cell = new DataGridViewButtonCell();
         cell.Value = username;
         row.Cells.Add(cell);
         DataGridViewCell cell2 = new DataGridViewButtonCell();
         cell2.Value = score;
         row.Cells.Add(cell2);
         playerDataGrid.Rows.Add(row);
     }
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: luarca84/Buscaminas
        private void PlayNewGame()
        {
            timer.Start();
            dateTimeInit = DateTime.Now;
            System.Media.SystemSounds.Asterisk.Play();
            numMinas = int.Parse(txtMinas.Text);
            numDificultad = int.Parse(txtDificultad.Text);

            DataTable dt = new DataTable();
            for (int i = 0; i < numDificultad; i++)
                dt.Columns.Add();
            for (int i = 0; i < numDificultad; i++)
                dt.Rows.Add(dt.NewRow());

            dgvMinas.DataSource = dt;
            dgvMinas.ColumnHeadersVisible = false;
            dgvMinas.RowHeadersVisible = false;
            dgvMinas.AllowUserToAddRows = false;
            dgvMinas.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dgvMinas.ReadOnly = true;
            dgvMinas.CellClick -= new DataGridViewCellEventHandler(dgvMinas_CellClick);
            dgvMinas.CellClick += new DataGridViewCellEventHandler(dgvMinas_CellClick);
            dgvMinas.MouseClick -= new MouseEventHandler(dgvMinas_MouseClick);
            dgvMinas.MouseClick += new MouseEventHandler(dgvMinas_MouseClick);

            for (int i = 0; i < numDificultad; i++)
                for (int j = 0; j < numDificultad; j++)
                {
                    DataGridViewButtonCell b = new DataGridViewButtonCell();
                    dgvMinas[i, j] = b;
                }

            matrix = new int[numDificultad, numDificultad];
            Random r = new Random();
            for (int n = 0; n < numMinas; n++)
            {
                int i = r.Next(numDificultad);
                int j = r.Next(numDificultad);
                if (matrix[i, j] == CTE_MINE)
                    n--;
                else
                    matrix[i, j] = CTE_MINE;
            }
        }
コード例 #10
0
ファイル: Main.ObjectInfo.cs プロジェクト: tuandnvn/ecat
        internal void showInformation(Object o)
        {
            objectProperties.Rows.Clear();
            objectProperties.Rows.Add(ID, o.id);
            objectProperties.Rows.Add(NAME, o.name);
            objectProperties.Rows.Add(GEN_TYPE, o.genType);
            objectProperties.Rows.Add(OBJECT_TYPE, "");
            objectProperties.Rows.Add(SEMANTIC_TYPE, o.semanticType);
            objectProperties.Rows.Add(COLOR, "");
            objectProperties.Rows.Add(BORDER_SIZE, "" + o.borderSize);

            // No change to id 
            objectProperties.Rows[Array.FindIndex(defaultRows, t => t == ID)].ReadOnly = true;

            // No change to gen type
            objectProperties.Rows[Array.FindIndex(defaultRows, t => t == GEN_TYPE)].Cells[objectProperties.Columns[1].Name].ReadOnly = true;

            // No change to object type
            objectProperties.Rows[Array.FindIndex(defaultRows, t => t == OBJECT_TYPE)].Cells[objectProperties.Columns[1].Name].ReadOnly = true;

            // Change cell for object type to ComboBox
            //DataGridViewComboBoxCell c1 = new DataGridViewComboBoxCell();
            //c1.DataSource = Enum.GetValues(typeof(Object.ObjectType));
            //c1.ValueType = typeof(Object.ObjectType);
            //c1.Value = o.objectType;
            //objectProperties.Rows[Array.FindIndex(defaultRows, t => t == OBJECT_TYPE)].Cells[objectProperties.Columns[1].Name] = c1;
            objectProperties.Rows[Array.FindIndex(defaultRows, t => t == OBJECT_TYPE)].Cells[objectProperties.Columns[1].Name].Value = o.objectType.ToString().Substring(1);

            // Change cell for color to button
            DataGridViewButtonCell c2 = new DataGridViewButtonCell();
            c2.FlatStyle = FlatStyle.Popup;
            c2.Style.BackColor = o.color;
            objectProperties.Rows[Array.FindIndex(defaultRows, t => t == COLOR)].Cells[objectProperties.Columns[1].Name] = c2;

            for (int i = 0; i < defaultRows.Count(); i++)
            {
                objectProperties.Rows[i].Cells[objectProperties.Columns[0].Name].ReadOnly = true;
            }

            foreach (var entry in o.otherProperties)
            {
                objectProperties.Rows.Add(entry.Key, entry.Value);
            }
        }
コード例 #11
0
        public void addToDataView(ProcessHandle ph)
        {
            ProcessHandleDataGridViewRow processHandleDataGridViewRow = new ProcessHandleDataGridViewRow(ph);
            string dir = ph.getProcessCaller().getDirectory();

            DirectoryDataGridViewTextBoxCell pid        = new DirectoryDataGridViewTextBoxCell(ph.getPID());
            DirectoryDataGridViewTextBoxCell directory  = new DirectoryDataGridViewTextBoxCell(dir);
            DirectoryDataGridViewTextBoxCell command    = new DirectoryDataGridViewTextBoxCell(ph.getProcessCaller().getCmd());
            DirectoryDataGridViewTextBoxCell cpu        = new DirectoryDataGridViewTextBoxCell(ph.getCPUUsage());
            DirectoryDataGridViewTextBoxCell ram        = new DirectoryDataGridViewTextBoxCell(ph.getRAMUsage());
            DirectoryDataGridViewTextBoxCell runTime    = new DirectoryDataGridViewTextBoxCell(ph.getRunningTime());
            DirectoryDataGridViewTextBoxCell blocker    = new DirectoryDataGridViewTextBoxCell(ph.getBlockedBy() != null ? ph.getBlockedBy().getPID() : "");
            DataGridViewButtonCell kill                 = new DataGridViewButtonCell();

            if (dir.Length > 50){
                int i = dir.Length;
                int num = 20;
                while (i > 50){
                    i--;
                    num++;
                }
                dir = dir.Substring(0, 5) + "....." + dir.Substring(num);
            }
            pid.Value = ph.getPID();
            directory.Value = dir;
            command.Value = ph.getProcessCaller().getCmd();
            cpu.Value = ph.getCPUUsage();
            ram.Value = ph.getRAMUsage();
            runTime.Value = ph.getRunningTime();
            blocker.Value = ph.getBlockedBy() != null ? ph.getBlockedBy().getPID() : "";
            kill.Value = "KILL";

            processHandleDataGridViewRow.Cells.Add(pid);
            processHandleDataGridViewRow.Cells.Add(directory);
            processHandleDataGridViewRow.Cells.Add(command);
            processHandleDataGridViewRow.Cells.Add(cpu);
            processHandleDataGridViewRow.Cells.Add(ram);
            processHandleDataGridViewRow.Cells.Add(runTime);
            processHandleDataGridViewRow.Cells.Add(blocker);
            processHandleDataGridViewRow.Cells.Add(kill);

            this.bottomUserControlProcessHandleDataGridView.Rows.Add(processHandleDataGridViewRow);
        }
コード例 #12
0
        public void BindButtonConfiguration(DataGridView gridView, BindingSource bindingSource)
        {
            CecButtonGridView = gridView;

              DataGridViewCell buttonCellTemplate = new DataGridViewTextBoxCell();
              CecButtonGridView.Columns.Add(new DataGridViewColumn(buttonCellTemplate)
                                      {
                                        DataPropertyName = "CecButtonName",
                                        Name = Resources.config_cec_button,
                                        ReadOnly = true,
                                        Width = 150
                                      });

              DataGridViewButtonCell mappedToCellTemplate = new DataGridViewButtonCell();
              CecButtonGridView.Columns.Add(new DataGridViewColumn(mappedToCellTemplate)
                                      {
                                        DataPropertyName = "MappedButtonName",
                                        Name = Resources.config_button_mapped_to,
                                        ReadOnly = true,
                                        Width = 350
                                      });

              bindingSource.DataSource = ButtonConfig;
              CecButtonGridView.DataSource = bindingSource;

              gridView.CellFormatting += delegate(object sender, DataGridViewCellFormattingEventArgs args)
                                   {
                                     DataGridView grid = sender as DataGridView;
                                     var data = grid != null ? grid.Rows[args.RowIndex].DataBoundItem as CecButtonConfigItem : null;
                                     if (data == null || !data.Enabled)
                                     {
                                       args.CellStyle.ForeColor = Color.Gray;
                                     }
                                   };

              gridView.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                              {
                                var item = args.RowIndex < ButtonConfig.Count ? ButtonConfig[args.RowIndex] : null;
                                if (item == null)
                                  return;
                                (new CecButtonConfigUI(item)).ShowDialog();
                              };

              foreach (var item in _buttonConfig)
              {
            item.SettingChanged += delegate
                                 {
                                   gridView.Refresh();
                                 };
              }
        }
コード例 #13
0
ファイル: Fmain.cs プロジェクト: Digiman/LabList
 /// <summary>
 /// Вывод данных в таблицу
 /// </summary>
 /// <param name="dgw">Таблица для вывода</param>
 public static void OutputDataToTable(DataGridView dgw)
 {
     dgw.RowCount = GlobalVars.Subjs.GetSubjectListCount;
     for (int i = 0; i < GlobalVars.Subjs.GetSubjectListCount; i++)
     {
         dgw.Rows[i].HeaderCell.Value = (i + 1).ToString();
         dgw[0, i].Value = GlobalVars.Subjs[i].Name;
         for (int j = 0; j < GlobalVars.Subjs[i].List.Items.Length; j++)
         {
             dgw[j + 1, i] = new DataGridViewButtonCell();
             dgw[j + 1, i].Value = "Info";
             dgw[j + 1, i].Style.BackColor = WorkData.GetStatusColor(GlobalVars.Subjs[i].List.Items[j].Status);
         }
         dgw[dgw.ColumnCount - 1, i].Value = WorkData.GetStatusName(GlobalVars.Subjs[i].Status);
         dgw[dgw.ColumnCount - 1, i].Style.BackColor = WorkData.GetStatusColor(GlobalVars.Subjs[i].Status);
     }
 }
コード例 #14
0
ファイル: AssetInformation.cs プロジェクト: zhshen/HuaweiAMS
        private void DoDisplayKeyPropertiesAndAutOptions()
        {
            buttonRemoveAuthPolOption.Enabled = false;
            buttonRemoveAuthPol.Enabled = false;
            buttonGetTestToken.Enabled = false;

            if (listViewKeys.SelectedItems.Count > 0)
            {
                IContentKey key = myAsset.ContentKeys.Skip(listViewKeys.SelectedIndices[0]).Take(1).FirstOrDefault();
                dataGridViewKeys.Rows.Clear();
                dataGridViewKeys.Rows.Add("Name", key.Name != null ? key.Name : "<no name>");
                dataGridViewKeys.Rows.Add("Id", key.Id);
                dataGridViewKeys.Rows.Add("Content key type", key.ContentKeyType);
                dataGridViewKeys.Rows.Add("Checksum", key.Checksum);
                dataGridViewKeys.Rows.Add("Created", key.Created.ToLocalTime().ToString("G"));
                dataGridViewKeys.Rows.Add("Last modified", key.LastModified.ToLocalTime().ToString("G"));
                dataGridViewKeys.Rows.Add("Protection key Id", key.ProtectionKeyId);
                dataGridViewKeys.Rows.Add("Protection key type", key.ProtectionKeyType);
                int i = dataGridViewKeys.Rows.Add("Clear Key Value", "see clear key");
                DataGridViewButtonCell btn = new DataGridViewButtonCell();
                dataGridViewKeys.Rows[i].Cells[1] = btn;
                dataGridViewKeys.Rows[i].Cells[1].Value = "See clear key";
                dataGridViewKeys.Rows[i].Cells[1].Tag = Convert.ToBase64String(key.GetClearKeyValue());

                listViewAutPolOptions.Items.Clear();
                dataGridViewAutPolOption.Rows.Clear();

                if (key.AuthorizationPolicyId != null)
                {
                    dataGridViewKeys.Rows.Add("Authorization Policy Id", key.AuthorizationPolicyId);
                    myAuthPolicy = myContext.ContentKeyAuthorizationPolicies.Where(p => p.Id == key.AuthorizationPolicyId).FirstOrDefault();
                    if (myAuthPolicy != null)
                    {
                        buttonRemoveAuthPol.Enabled = true;
                        dataGridViewKeys.Rows.Add("Authorization Policy Name", myAuthPolicy.Name);
                        listViewAutPolOptions.BeginUpdate();
                        foreach (var option in myAuthPolicy.Options)
                        {
                            ListViewItem item = new ListViewItem((string.IsNullOrEmpty(option.Name) ? "<no name>" : option.Name), 0);
                            listViewAutPolOptions.Items.Add(item);
                        }
                        listViewAutPolOptions.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                        listViewAutPolOptions.EndUpdate();
                        if (listViewAutPolOptions.Items.Count > 0) listViewAutPolOptions.Items[0].Selected = true;
                    }
                }
                else
                {
                    myAuthPolicy = null;
                }
            }
            else
            {
                myAuthPolicy = null;
            }
        }
コード例 #15
0
ファイル: Lobby.cs プロジェクト: ryselis/viktoro_viktorina
 private void InitDataTable()
 {
     playerDataGrid.AutoGenerateColumns = false;
     playerDataGrid.Rows.Clear();
     foreach (var player in Settings.Settings.GetPlayers())
     {
         string username = player.ToString();
         DataGridViewRow row = new DataGridViewRow();
         DataGridViewCell cell = new DataGridViewButtonCell();
         cell.Value = username;
         row.Cells.Add(cell);
         DataGridViewCell cell2 = new DataGridViewButtonCell();
         User user = DataSender.DataSender.GetUser(username);
         cell2.Value = user.CorrectAnswerCount;
         row.Cells.Add(cell2);
         DataGridViewCell cell3 = new DataGridViewButtonCell();
         try
         {
             cell3.Value = 100 * user.CorrectAnswerCount / user.AnswerCount;
         }
         catch (DivideByZeroException exc)
         {
             cell3.Value = 0;
         }
         row.Cells.Add(cell3);
         playerDataGrid.Rows.Add(row);
     }
 }
コード例 #16
0
 /// <summary>
 /// 添加删除列
 /// </summary>
 private void AddAppColumns(DataGridView grid, string columnName)
 {
     if (grid.Columns.Contains(columnName)) grid.Columns.Remove(columnName);//若此已存在则先将其删除
     DataGridViewButtonCell cell = new DataGridViewButtonCell();
     DataGridViewButtonColumn column = new DataGridViewButtonColumn();
     column.ValueType = typeof(string);
     column.UseColumnTextForButtonValue = true;
     column.Name = columnName;
     column.HeaderText = "删除";
     column.CellTemplate = cell;
     grid.Columns.Add(column);
     foreach (var row in grid.Rows)
     {
         DataGridViewCell c = ((DataGridViewRow)row).Cells[columnName];
         c.Value = "删除";
     }
 }
コード例 #17
0
        private void DoDisplayAuthorizationPolicyOption()
        {
            bool DisplayButGetToken = false;

            if (listViewAutPolOptions.SelectedItems.Count > 0)
            {
                dataGridViewAutPolOption.Rows.Clear();

                IContentKeyAuthorizationPolicyOption option = myAuthPolicy.Options.Skip(listViewAutPolOptions.SelectedIndices[0]).Take(1).FirstOrDefault();
                if (option != null) // Token option
                {
                    dataGridViewAutPolOption.Rows.Add("Name", option.Name != null ? option.Name : "<no name>");
                    dataGridViewAutPolOption.Rows.Add("Id", option.Id);

                    // Key delivery configuration

                    int i = dataGridViewAutPolOption.Rows.Add("KeyDeliveryConfiguration", "<null>");
                    if (option.KeyDeliveryConfiguration != null)
                    {
                        DataGridViewButtonCell btn = new DataGridViewButtonCell();
                        dataGridViewAutPolOption.Rows[i].Cells[1] = btn;
                        dataGridViewAutPolOption.Rows[i].Cells[1].Value = "See value";
                        dataGridViewAutPolOption.Rows[i].Cells[1].Tag = option.KeyDeliveryConfiguration;
                    }

                    dataGridViewAutPolOption.Rows.Add("KeyDeliveryType", option.KeyDeliveryType);

                    List<ContentKeyAuthorizationPolicyRestriction> objList_restriction = option.Restrictions;
                    foreach (var restriction in objList_restriction)
                    {
                        dataGridViewAutPolOption.Rows.Add("Restriction Name", restriction.Name);
                        dataGridViewAutPolOption.Rows.Add("Restriction KeyRestrictionType", (ContentKeyRestrictionType)restriction.KeyRestrictionType);
                        if ((ContentKeyRestrictionType)restriction.KeyRestrictionType == ContentKeyRestrictionType.TokenRestricted)
                        {
                            DisplayButGetToken = true;
                        }
                        if (restriction.Requirements != null)
                        {
                            // Restriction Requirements
                            i = dataGridViewAutPolOption.Rows.Add("Restriction Requirements", "<null>");
                            if (restriction.Requirements != null)
                            {
                                DataGridViewButtonCell btn2 = new DataGridViewButtonCell();
                                dataGridViewAutPolOption.Rows[i].Cells[1] = btn2;
                                dataGridViewAutPolOption.Rows[i].Cells[1].Value = "See value";
                                dataGridViewAutPolOption.Rows[i].Cells[1].Tag = restriction.Requirements;

                                TokenRestrictionTemplate tokenTemplate = TokenRestrictionTemplateSerializer.Deserialize(restriction.Requirements);
                                dataGridViewAutPolOption.Rows.Add("Token Type", tokenTemplate.TokenType);

                                i = dataGridViewAutPolOption.Rows.Add("Primary Verification Key", "<null>");
                                if (tokenTemplate.PrimaryVerificationKey != null)
                                {
                                    dataGridViewAutPolOption.Rows.Add("Token Verification Key Type", (tokenTemplate.PrimaryVerificationKey.GetType() == typeof(SymmetricVerificationKey)) ? "Symmetric" : "Asymmetric (X509)");
                                    if (tokenTemplate.PrimaryVerificationKey.GetType() == typeof(SymmetricVerificationKey))
                                    {
                                        var verifkey = (SymmetricVerificationKey)tokenTemplate.PrimaryVerificationKey;
                                        btn2 = new DataGridViewButtonCell();
                                        dataGridViewAutPolOption.Rows[i].Cells[1] = btn2;
                                        dataGridViewAutPolOption.Rows[i].Cells[1].Value = "See key value";
                                        dataGridViewAutPolOption.Rows[i].Cells[1].Tag = Convert.ToBase64String(verifkey.KeyValue);
                                    }
                                }


                                foreach (var verifkey in tokenTemplate.AlternateVerificationKeys)
                                {
                                    i = dataGridViewAutPolOption.Rows.Add("Alternate Verification Key", "<null>");
                                    if (verifkey != null)
                                    {
                                        dataGridViewAutPolOption.Rows.Add("Token Verification Key Type", (verifkey.GetType() == typeof(SymmetricVerificationKey)) ? "Symmetric" : "Asymmetric (X509)");
                                        if (verifkey.GetType() == typeof(SymmetricVerificationKey))
                                        {
                                            var verifkeySym = (SymmetricVerificationKey)verifkey;
                                            btn2 = new DataGridViewButtonCell();
                                            dataGridViewAutPolOption.Rows[i].Cells[1] = btn2;
                                            dataGridViewAutPolOption.Rows[i].Cells[1].Value = "See key value";
                                            dataGridViewAutPolOption.Rows[i].Cells[1].Tag = Convert.ToBase64String(verifkeySym.KeyValue);
                                        }
                                    }
                                }

                                if (tokenTemplate.OpenIdConnectDiscoveryDocument != null)
                                {
                                    dataGridViewAutPolOption.Rows.Add("OpenId Connect Discovery Document Uri", tokenTemplate.OpenIdConnectDiscoveryDocument.OpenIdDiscoveryUri);
                                }
                                dataGridViewAutPolOption.Rows.Add("Token Audience", tokenTemplate.Audience);
                                dataGridViewAutPolOption.Rows.Add("Token Issuer", tokenTemplate.Issuer);
                                foreach (var claim in tokenTemplate.RequiredClaims)
                                {
                                    dataGridViewAutPolOption.Rows.Add("Required Claim, Type", claim.ClaimType);
                                    dataGridViewAutPolOption.Rows.Add("Required Claim, Value", claim.ClaimValue);
                                }
                            }
                        }
                    }
                }
            }
            buttonGetTestToken.Enabled = DisplayButGetToken;
            buttonRemoveAuthPol.Enabled = true;
        }
コード例 #18
0
        protected override Size GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize)
        {
            if (DataGridView == null)
            {
                return(new Size(-1, -1));
            }

            if (cellStyle == null)
            {
                throw new ArgumentNullException(nameof(cellStyle));
            }

            Size      preferredSize;
            Rectangle borderWidthsRect = StdBorderWidths;
            int       borderAndPaddingWidths = borderWidthsRect.Left + borderWidthsRect.Width + cellStyle.Padding.Horizontal;
            int       borderAndPaddingHeights = borderWidthsRect.Top + borderWidthsRect.Height + cellStyle.Padding.Vertical;
            DataGridViewFreeDimension freeDimension = DataGridViewCell.GetFreeDimensionFromConstraint(constraintSize);
            int    marginWidths, marginHeights;
            string formattedString = GetFormattedValue(rowIndex, ref cellStyle, DataGridViewDataErrorContexts.Formatting | DataGridViewDataErrorContexts.PreferredSize) as string;

            if (string.IsNullOrEmpty(formattedString))
            {
                formattedString = " ";
            }
            TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);

            // Adding space for text padding.
            if (DataGridView.ApplyVisualStylesToInnerCells)
            {
                Rectangle rectThemeMargins = DataGridViewButtonCell.GetThemeMargins(graphics);
                marginWidths  = rectThemeMargins.X + rectThemeMargins.Width;
                marginHeights = rectThemeMargins.Y + rectThemeMargins.Height;
            }
            else
            {
                // Hardcoding 5 for the button borders for now.
                marginWidths = marginHeights = DATAGRIDVIEWBUTTONCELL_textPadding;
            }

            switch (freeDimension)
            {
            case DataGridViewFreeDimension.Width:
            {
                if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1 &&
                    constraintSize.Height - borderAndPaddingHeights - marginHeights - 2 * DATAGRIDVIEWBUTTONCELL_verticalTextMargin > 0)
                {
                    preferredSize = new Size(
                        MeasureTextWidth(
                            graphics,
                            formattedString,
                            cellStyle.Font,
                            constraintSize.Height - borderAndPaddingHeights - marginHeights - 2
                            * DATAGRIDVIEWBUTTONCELL_verticalTextMargin,
                            flags),
                        0);
                }
                else
                {
                    preferredSize = new Size(
                        MeasureTextSize(graphics, formattedString, cellStyle.Font, flags).Width,
                        0);
                }
                break;
            }

            case DataGridViewFreeDimension.Height:
            {
                if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1 &&
                    constraintSize.Width - borderAndPaddingWidths - marginWidths - 2 * DATAGRIDVIEWBUTTONCELL_horizontalTextMargin > 0)
                {
                    preferredSize = new Size(
                        0,
                        MeasureTextHeight(
                            graphics,
                            formattedString,
                            cellStyle.Font,
                            constraintSize.Width - borderAndPaddingWidths - marginWidths - 2 * DATAGRIDVIEWBUTTONCELL_horizontalTextMargin,
                            flags));
                }
                else
                {
                    preferredSize = new Size(
                        0,
                        MeasureTextSize(
                            graphics,
                            formattedString,
                            cellStyle.Font,
                            flags).Height);
                }
                break;
            }

            default:
            {
                if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1)
                {
                    preferredSize = MeasureTextPreferredSize(graphics, formattedString, cellStyle.Font, 5.0F, flags);
                }
                else
                {
                    preferredSize = MeasureTextSize(graphics, formattedString, cellStyle.Font, flags);
                }
                break;
            }
            }

            if (freeDimension != DataGridViewFreeDimension.Height)
            {
                preferredSize.Width += borderAndPaddingWidths + marginWidths + 2 * DATAGRIDVIEWBUTTONCELL_horizontalTextMargin;
                if (DataGridView.ShowCellErrors)
                {
                    // Making sure that there is enough room for the potential error icon
                    preferredSize.Width = Math.Max(preferredSize.Width, borderAndPaddingWidths + IconMarginWidth * 2 + s_iconsWidth);
                }
            }

            if (freeDimension != DataGridViewFreeDimension.Width)
            {
                preferredSize.Height += borderAndPaddingHeights + marginHeights + 2 * DATAGRIDVIEWBUTTONCELL_verticalTextMargin;
                if (DataGridView.ShowCellErrors)
                {
                    // Making sure that there is enough room for the potential error icon
                    preferredSize.Height = Math.Max(preferredSize.Height, borderAndPaddingHeights + IconMarginHeight * 2 + s_iconsHeight);
                }
            }

            return(preferredSize);
        }
コード例 #19
0
        /// <summary>
        /// Add a leg to the spread given a SpreadLegDetails object.
        /// </summary>
        /// <param name="spreadLegParams">SpreadLegDetails</param>
        private void addLeg(SpreadLegDetails spreadLegParams)
        {
            DataGridViewColumn col = new DataGridViewColumn();
            col.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            col.Width = 150;

            col.HeaderText = "Leg " + Convert.ToString(dataGridViewSpreadDetails.Columns.Count);
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            DataGridViewTextBoxCell textCell = new DataGridViewTextBoxCell();
            textCell.Style.BackColor = Color.White;
            col.CellTemplate = textCell;
            int retunValue = dataGridViewSpreadDetails.Columns.Add(col);
            int columnNum = dataGridViewSpreadDetails.Columns.Count;

            DataGridViewButtonCell cell = new DataGridViewButtonCell();
            cell.ToolTipText = "Delete this leg";
            cell.Value = "Delete this leg";
            cell.Style.BackColor = Color.Red;
            dataGridViewSpreadDetails.Rows[(int)FieldType.DeleteButton].Cells[columnNum - 1] = cell;

            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.Name;
            dataGridViewSpreadDetails.Rows[(int)FieldType.Contract].Cells[columnNum - 1] = textCell;

            DataGridViewComboBoxCell comboCell = new DataGridViewComboBoxCell();
            comboCell.DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
            comboCell.Items.Add(spreadLegParams.InstrumentKey.MarketKey.Name);
            dataGridViewSpreadDetails.Rows[(int)FieldType.OrderFeedCombo].Cells[columnNum - 1] = comboCell;
            comboCell.Value = spreadLegParams.InstrumentKey.MarketKey.Name;

            comboCell = new DataGridViewComboBoxCell();
            comboCell.Items.Add(spreadLegParams.CustomerName);
            comboCell.Value = comboCell.Items[0];
            dataGridViewSpreadDetails.Rows[(int)FieldType.CustomerAccount].Cells[columnNum - 1] = comboCell;

            DataGridViewCheckBoxCell checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.ActiveQuoting;
            dataGridViewSpreadDetails.Rows[(int)FieldType.ActiveQuoting].Cells[columnNum - 1] = checkCell;

            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.ConsiderOwnOrders;
            dataGridViewSpreadDetails.Rows[(int)FieldType.ConsiderOwnOrders].Cells[columnNum - 1] = checkCell;

            comboCell = new DataGridViewComboBoxCell();
            comboCell.Items.Add("LimitOrder");
            comboCell.Items.Add("MarketOrder");
            comboCell.Items.Add("MLMOrder");
            comboCell.Value = spreadLegParams.OffsetHedgeType.ToString();
            dataGridViewSpreadDetails.Rows[(int)FieldType.OffsetHedge].Cells[columnNum - 1] = comboCell;

            //Payup ticks
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.PayupTicks;
            dataGridViewSpreadDetails.Rows[(int)FieldType.PayupTicks].Cells[columnNum - 1] = textCell;

            //spread ratio
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.SpreadRatio;
            dataGridViewSpreadDetails.Rows[(int)FieldType.SpreadRatio].Cells[columnNum - 1] = textCell;

            //spread Multiplier
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.PriceMultiplier;
            dataGridViewSpreadDetails.Rows[(int)FieldType.SpreadMultiplier].Cells[columnNum - 1] = textCell;

            //offset volume multiplier
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.QuantityMultiplier;
            dataGridViewSpreadDetails.Rows[(int)FieldType.QuantityMultiplier].Cells[columnNum - 1] = textCell;

            //base volume mulitplier
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.BaseVolumeLean;
            dataGridViewSpreadDetails.Rows[(int)FieldType.BasicVolumeLean].Cells[columnNum - 1] = textCell;

            //use cancel replace
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.UseCancelReplace; 
            dataGridViewSpreadDetails.Rows[(int)FieldType.UserCancelReplace].Cells[columnNum - 1] = checkCell;

            //Queue Holder orders
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.QueueHolderOrders;
            dataGridViewSpreadDetails.Rows[(int)FieldType.QueueHolderOrders].Cells[columnNum - 1] = textCell;

            //inside smart quote
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.InsideSmartQuote;
            dataGridViewSpreadDetails.Rows[(int)FieldType.InsideSmartQuote].Cells[columnNum - 1] = textCell;

            //Smart Quote Limit
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.SmartQuoteLimit;
            dataGridViewSpreadDetails.Rows[(int)FieldType.SmartQuoteLimit].Cells[columnNum - 1] = textCell;

            //Consider implied
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.ConsiderImplied;
            dataGridViewSpreadDetails.Rows[(int)FieldType.ConsiderImplied].Cells[columnNum - 1] = checkCell;

            //Hedge round
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.HedgeRound;
            dataGridViewSpreadDetails.Rows[(int)FieldType.HedgeRound].Cells[columnNum - 1] = checkCell;

            //Max Price Move
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.MaxPriceMove;
            dataGridViewSpreadDetails.Rows[(int)FieldType.MaxPriceMove].Cells[columnNum - 1] = textCell;

            //Max Order Move
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.MaxOrderMove;
            dataGridViewSpreadDetails.Rows[(int)FieldType.MaxOrderMove].Cells[columnNum - 1] = textCell;

            //Cancel replace for Quantity
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.UseCancelReplaceForQtyReduction;
            dataGridViewSpreadDetails.Rows[(int)FieldType.CancelReplaceForQuantity].Cells[columnNum - 1] = checkCell;

            //1/Price
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = spreadLegParams.OneOverPrice;
            dataGridViewSpreadDetails.Rows[(int)FieldType.OneOverPrice].Cells[columnNum - 1] = checkCell;

            //Hidden row has the actual object ot instrument
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = spreadLegParams.InstrumentKey;
            dataGridViewSpreadDetails.Rows[(int)FieldType.HiddenObject].Visible = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.HiddenObject].Cells[columnNum - 1] = textCell;

            if (m_spreadLegs.ContainsKey(spreadLegParams.InstrumentKey))
            {
                Instrument instrument = (Instrument)m_spreadLegs[spreadLegParams.InstrumentKey];
                updateInstrument(instrument);

                // Select the right order feed
                DataGridViewComboBoxCell combo = (DataGridViewComboBoxCell)dataGridViewSpreadDetails.Rows[(int)FieldType.OrderFeedCombo].Cells[columnNum - 1];
                foreach (string orderFeedName in combo.Items)
                {
                    if (orderFeedName.Equals(spreadLegParams.InstrumentKey.MarketKey.Name))
                    {
                        combo.Value = orderFeedName;
                        break;
                    }
                }
            }
            else
            {
                // Pass the Key to our subscription method
                findInstrument(spreadLegParams.InstrumentKey);
            }
        }
コード例 #20
0
        /// <summary>
        /// Add a new leg to the spread given a InstrumentKey.
        /// </summary>
        /// <param name="instrKey">InstrumentKey</param>
        private void addDefaultLeg(InstrumentKey instrKey)
        {
            DataGridViewColumn col = new DataGridViewColumn();
            col.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            col.Width = 150;

            col.HeaderText = "Leg " + Convert.ToString(dataGridViewSpreadDetails.Columns.Count);

            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            DataGridViewTextBoxCell textCell = new DataGridViewTextBoxCell();
            textCell.Style.BackColor = Color.White;
            col.CellTemplate = textCell;
            int retunValue = dataGridViewSpreadDetails.Columns.Add(col);
            int columnNum = dataGridViewSpreadDetails.Columns.Count;

            DataGridViewButtonCell cell = new DataGridViewButtonCell();
            cell.ToolTipText = "Delete this leg";
            cell.Style.BackColor = Color.Red;
            cell.Value = "Delete this leg";

            dataGridViewSpreadDetails.Rows[(int)FieldType.DeleteButton].Cells[columnNum - 1] = cell;

            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "Waiting for subscription";
            dataGridViewSpreadDetails.Rows[(int)FieldType.Contract].Cells[columnNum - 1] = textCell;

            DataGridViewComboBoxCell comboCell = new DataGridViewComboBoxCell();
            comboCell.DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
            comboCell.Items.Clear();
            dataGridViewSpreadDetails.Rows[(int)FieldType.OrderFeedCombo].Cells[columnNum - 1] = comboCell;

            comboCell = new DataGridViewComboBoxCell();
            comboCell.Items.Add("<Default>");
            comboCell.Value = comboCell.Items[0];
            dataGridViewSpreadDetails.Rows[(int)FieldType.CustomerAccount].Cells[columnNum - 1] = comboCell;

            DataGridViewCheckBoxCell checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = true;
            dataGridViewSpreadDetails.Rows[(int)FieldType.ActiveQuoting].Cells[columnNum - 1] = checkCell;

            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.ConsiderOwnOrders].Cells[columnNum - 1] = checkCell;

            comboCell = new DataGridViewComboBoxCell();
            comboCell.Items.Add("LimitOrder");
            comboCell.Items.Add("MarketOrder");
            comboCell.Items.Add("MLMOrder");
            comboCell.Value = comboCell.Items[0];
            dataGridViewSpreadDetails.Rows[(int)FieldType.OffsetHedge].Cells[columnNum - 1] = comboCell;

            //Payup ticks
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "0";
            dataGridViewSpreadDetails.Rows[(int)FieldType.PayupTicks].Cells[columnNum - 1] = textCell;

            //spread ratio
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = (columnNum % 2) == 0 ? "1" : "-1";
            dataGridViewSpreadDetails.Rows[(int)FieldType.SpreadRatio].Cells[columnNum - 1] = textCell;

            //spread Multiplier
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = (columnNum % 2) == 0 ? "1" : "-1";
            dataGridViewSpreadDetails.Rows[(int)FieldType.SpreadMultiplier].Cells[columnNum - 1] = textCell;

            //offset volume multiplier
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "1";
            dataGridViewSpreadDetails.Rows[(int)FieldType.QuantityMultiplier].Cells[columnNum - 1] = textCell;

            //base volume mulitplier
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "0";
            dataGridViewSpreadDetails.Rows[(int)FieldType.BasicVolumeLean].Cells[columnNum - 1] = textCell;

            //use cancel replace
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.UserCancelReplace].Cells[columnNum - 1] = checkCell;

            //Queue Holder orders
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "0";
            dataGridViewSpreadDetails.Rows[(int)FieldType.QueueHolderOrders].Cells[columnNum - 1] = textCell;

            //inside smart quote
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "99";
            dataGridViewSpreadDetails.Rows[(int)FieldType.InsideSmartQuote].Cells[columnNum - 1] = textCell;

            //Smart Quote Limit
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "99";
            dataGridViewSpreadDetails.Rows[(int)FieldType.SmartQuoteLimit].Cells[columnNum - 1] = textCell;

            //Consider implied
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = true;
            dataGridViewSpreadDetails.Rows[(int)FieldType.ConsiderImplied].Cells[columnNum - 1] = checkCell;

            //Hedge round
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.HedgeRound].Cells[columnNum - 1] = checkCell;

            //Max Price Move
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "9999";
            dataGridViewSpreadDetails.Rows[(int)FieldType.MaxPriceMove].Cells[columnNum - 1] = textCell;

            //Max Order Move
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = "9999";
            dataGridViewSpreadDetails.Rows[(int)FieldType.MaxOrderMove].Cells[columnNum - 1] = textCell;

            //Cancel replace for Quantity
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.CancelReplaceForQuantity].Cells[columnNum - 1] = checkCell;

            //1/Price
            checkCell = new DataGridViewCheckBoxCell();
            checkCell.Value = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.OneOverPrice].Cells[columnNum - 1] = checkCell;

            //Hidden row has the actual object ot instrument
            textCell = new DataGridViewTextBoxCell();
            textCell.Value = instrKey;
            dataGridViewSpreadDetails.Rows[(int)FieldType.HiddenObject].Visible = false;
            dataGridViewSpreadDetails.Rows[(int)FieldType.HiddenObject].Cells[columnNum - 1] = textCell;
        }
コード例 #21
0
ファイル: SystemSetting.cs プロジェクト: wcgcw/Finder
        private void IniDgv2()
        {
            dgv2.Columns.Clear();
            DataGridViewTextBoxCell txt_cell = new DataGridViewTextBoxCell();
            DataGridViewButtonCell btn_cell = new DataGridViewButtonCell();
            DataGridViewComboBoxCell cbo_cell = new DataGridViewComboBoxCell();
            DataGridViewImageCell img_cell = new DataGridViewImageCell();
            img_cell.ImageLayout = DataGridViewImageCellLayout.Zoom;

            DataGridViewColumn cl_gjz = new DataGridViewColumn();
            cl_gjz.HeaderText = "事件";
            cl_gjz.CellTemplate = txt_cell;
            cl_gjz.ReadOnly = true;
            cl_gjz.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_gjz);

            DataGridViewColumn cl_jgsj = new DataGridViewColumn();
            cl_jgsj.HeaderText = "间隔时间(小时)";
            cl_jgsj.CellTemplate = txt_cell;
            cl_jgsj.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_jgsj);

            DataGridViewColumn cl_cs = new DataGridViewColumn();
            cl_cs.HeaderText = "出现次数";
            cl_cs.CellTemplate = txt_cell;
            cl_cs.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_cs);

            DataGridViewComboBoxColumn cl_warncontent = new DataGridViewComboBoxColumn();
            cl_warncontent.HeaderText = "选择声音";
            cl_warncontent.CellTemplate = cbo_cell;
            cl_warncontent.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_warncontent);

            DataGridViewColumn cl_playSound = new DataGridViewColumn();
            cl_playSound.HeaderText = "试听";
            cl_playSound.CellTemplate = img_cell;
            cl_playSound.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_playSound);

            DataGridViewColumn cl_bj1 = new DataGridViewColumn();
            cl_bj1.HeaderText = "";
            cl_bj1.CellTemplate = btn_cell;
            cl_bj1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_bj1);

            DataGridViewColumn cl_cz1 = new DataGridViewColumn();
            cl_cz1.HeaderText = "";
            cl_cz1.CellTemplate = btn_cell;
            cl_cz1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv2.Columns.Add(cl_cz1);

            //dgv2.CellContentClick += new DataGridViewCellEventHandler(dgv2_CellContentClick);
        }
コード例 #22
0
ファイル: SystemSetting.cs プロジェクト: wcgcw/Finder
        private void IniDgv1()
        {
            DataGridViewTextBoxCell txt_cell = new DataGridViewTextBoxCell();
            DataGridViewButtonCell btn_cell = new DataGridViewButtonCell();

            DataGridViewColumn cl_gjz = new DataGridViewColumn();
            cl_gjz.HeaderText = "事件";
            cl_gjz.CellTemplate = txt_cell;
            cl_gjz.ReadOnly = true;
            cl_gjz.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_gjz);

            DataGridViewColumn cl_jgsj = new DataGridViewColumn();
            cl_jgsj.HeaderText = "间隔时间(小时)";
            cl_jgsj.CellTemplate = txt_cell;
            cl_jgsj.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_jgsj);

            DataGridViewColumn cl_cs = new DataGridViewColumn();
            cl_cs.HeaderText = "出现次数";
            cl_cs.CellTemplate = txt_cell;
            cl_cs.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_cs);

            DataGridViewColumn cl_warncontent = new DataGridViewColumn();
            cl_warncontent.HeaderText = "短信内容";
            cl_warncontent.CellTemplate = txt_cell;
            cl_warncontent.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_warncontent);

            DataGridViewColumn cl_mobile = new DataGridViewColumn();
            cl_mobile.HeaderText = "电话号码";
            cl_mobile.CellTemplate = txt_cell;
            cl_mobile.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_mobile);

            DataGridViewColumn cl_bj = new DataGridViewColumn();
            cl_bj.HeaderText = "";
            cl_bj.CellTemplate = btn_cell;
            cl_bj.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_bj);

            DataGridViewColumn cl_cz = new DataGridViewColumn();
            cl_cz.HeaderText = "";
            cl_cz.CellTemplate = btn_cell;
            cl_cz.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgv1.Columns.Add(cl_cz);

            //dgv1.CellContentClick += new DataGridViewCellEventHandler(dgv1_CellContentClick);
        }
コード例 #23
0
        private void cargarGrilla()
        {
            Micros.Columns.Clear();
            Micros.DataSource = Micro.BuscarMicro(campoMatricula.Text, Convert.ToString(idServicio.SelectedValue), Convert.ToString(idMarca.SelectedValue), Convert.ToString(idModelo.SelectedValue), capacidad.Text);
            /*Columnas para los botones*/

            if (Micros.Rows.Count == 0)
                return;

            DataGridViewColumn Modificar = new DataGridViewButtonColumn();
            Modificar.HeaderText = "Modificar";
            Modificar.Name = "Modificar";
            Modificar.Visible = true;

            DataGridViewColumn enServicio = new DataGridViewButtonColumn();
            enServicio.HeaderText = "Estado del servicio";
            enServicio.Name = "Estado del servicio";
            enServicio.Visible = true;

            DataGridViewColumn Habilitar = new DataGridViewButtonColumn();
            Habilitar.HeaderText = "Habilitar";
            Habilitar.Name = "Habilitar";
            Habilitar.Visible = true;

            DataGridViewColumn BajaDefinitiva = new DataGridViewButtonColumn();
            BajaDefinitiva.HeaderText = "Baja Definitiva";
            BajaDefinitiva.Name = "Baja Definitiva";
            BajaDefinitiva.Visible = true;

            Micros.Columns.Add(Modificar);
            Micros.Columns.Add(enServicio);
            Micros.Columns.Add(Habilitar);
            Micros.Columns.Add(BajaDefinitiva);

            /*Botones*/

            foreach (DataGridViewRow row in Micros.Rows)
            {
                DataGridViewButtonCell btnModificar = new DataGridViewButtonCell();
                btnModificar.UseColumnTextForButtonValue = false;
                btnModificar.Value = "Modificar";

                DataGridViewButtonCell btnEstado = new DataGridViewButtonCell();
                btnEstado.UseColumnTextForButtonValue = false;
                btnEstado.Value = "Realizar Mantenimiento";

                DataGridViewButtonCell btnHabilitar = new DataGridViewButtonCell();
                btnHabilitar.UseColumnTextForButtonValue = false;

                DataGridViewButtonCell btnBajaDefinitiva = new DataGridViewButtonCell();
                btnBajaDefinitiva.UseColumnTextForButtonValue = false;
                btnBajaDefinitiva.Value = "Baja definitiva";

                if (Convert.ToInt32(row.Cells["Habilitado"].Value) == 0)
                {
                    btnHabilitar.Value = "Habilitar";
                    row.DefaultCellStyle.BackColor = Color.LightGray;
                }
                else
                {
                    btnHabilitar.Value = "Deshabilitar";
                }

                row.Cells["Modificar"] = btnModificar;
                row.Cells["Estado del servicio"] = btnEstado;
                row.Cells["Habilitar"] = btnHabilitar;
                row.Cells["Baja Definitiva"] = btnBajaDefinitiva;
            }

            Micros.ClearSelection();
        }
コード例 #24
0
ファイル: Form1.cs プロジェクト: PERCYad/evolucionae
        private void inicializarGridHorario()
        {
            int hora= 7;
            DataGridViewCell dgc = new DataGridViewButtonCell();
            //Recorremos el DataGridView con un bucle for
            //dataGridView1.Rows. = 13;

               for (int i = 0; i < 14; i++)
            {
                string[] row = { hora.ToString(), "", "", "", "", "" };

                dgvHorario.Rows.Add(row);
                //dgvHorario.Rows[i].Cells[0].Value= hora;
                //celda = ((String)dgc.Value) + "\r\n";
                //textBox1.Text += celda.Replace(".", ",");
                hora++;
            }
        }
コード例 #25
0
 private void SetColumnButtonText(DataGridViewButtonCell button, string text)
 {
     button.UseColumnTextForButtonValue = false;
     button.Value = text;
 }
コード例 #26
0
        private void DoDisplayKeyProperties()
        {
            if (listViewKeys.SelectedItems.Count > 0)
            {
                IContentKey key = myAsset.ContentKeys.Skip(listViewKeys.SelectedIndices[0]).Take(1).FirstOrDefault();
                dataGridViewKeys.Rows.Clear();
                dataGridViewKeys.Rows.Add("Name", key.Name != null ? key.Name : "<no name>");
                dataGridViewKeys.Rows.Add("Id", key.Id);
                dataGridViewKeys.Rows.Add("Content key type", key.ContentKeyType);
                dataGridViewKeys.Rows.Add("Checksum", key.Checksum);
                dataGridViewKeys.Rows.Add("Created", key.Created.ToLocalTime().ToString("G"));
                dataGridViewKeys.Rows.Add("Las modified", key.LastModified.ToLocalTime().ToString("G"));
                dataGridViewKeys.Rows.Add("Protection key Id", key.ProtectionKeyId);
                dataGridViewKeys.Rows.Add("Protection key type", key.ProtectionKeyType);
                int i = dataGridViewKeys.Rows.Add("Clear Key Value", "see clear key");
                DataGridViewButtonCell btn = new DataGridViewButtonCell();
                dataGridViewKeys.Rows[i].Cells[1] = btn;
                dataGridViewKeys.Rows[i].Cells[1].Value = "See clear key";
                dataGridViewKeys.Rows[i].Cells[1].Tag = Convert.ToBase64String(key.GetClearKeyValue());

                listViewAutPolOptions.Items.Clear();
                dataGridViewAutPolOption.Rows.Clear();

                if (key.AuthorizationPolicyId != null)
                {
                    dataGridViewKeys.Rows.Add("Authorization Policy Id", key.AuthorizationPolicyId);
                    myAuthPolicy = myContext.ContentKeyAuthorizationPolicies.Where(p => p.Id == key.AuthorizationPolicyId).FirstOrDefault();
                    if (myAuthPolicy != null)
                    {
                        dataGridViewKeys.Rows.Add("Authorization Policy Name", myAuthPolicy.Name);
                        listViewAutPolOptions.BeginUpdate();
                        foreach (var option in myAuthPolicy.Options)
                        {
                            ListViewItem item = new ListViewItem((string.IsNullOrEmpty(myAuthPolicy.Name) ? "<no name>" : myAuthPolicy.Name) + " / " + (string.IsNullOrEmpty(option.Name) ? "<no name>" : option.Name), 0);
                            listViewAutPolOptions.Items.Add(item);
                        }
                        listViewAutPolOptions.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                        listViewAutPolOptions.EndUpdate();
                        if (listViewAutPolOptions.Items.Count > 0) listViewAutPolOptions.Items[0].Selected = true;
                    }
                }
                else
                {
                    myAuthPolicy = null;
                }
                /* // No need for this
                switch (key.ContentKeyType)
                {

                    case ContentKeyType.CommonEncryption:
                        string DelUrl;
                        try
                        {
                            DelUrl = key.GetKeyDeliveryUrl(ContentKeyDeliveryType.PlayReadyLicense).OriginalString;
                        }
                        catch (Exception e) // Perhaps PlayReady license delivery has been activated
                        {
                            if (e.InnerException == null)
                            {
                                DelUrl = e.Message;
                            }
                            else
                            {
                                DelUrl = string.Format("{0} ({1})", e.Message, Program.GetErrorMessage(e));
                            }
                        }
                        dataGridViewKeys.Rows.Add("GetkeyDeliveryUrl", DelUrl);
                        break;

                    case ContentKeyType.EnvelopeEncryption:
                        dataGridViewKeys.Rows.Add("GetkeyDeliveryUrl", key.GetKeyDeliveryUrl(ContentKeyDeliveryType.BaselineHttp).OriginalString);
                        break;


                    default:
                        break;

                }*/
            }
            else
            {
                myAuthPolicy = null;
            }
        }
コード例 #27
0
        private void LoadUsage()
        {
            m_editcon = true;
            this.dataGridViewConceptRules.Rows.Clear();
            this.dataGridViewConceptRules.Columns.Clear();

            if (this.m_conceptroot == null || this.m_conceptleaf == null)// || !this.m_conceptroot.Concepts.Contains(this.m_conceptleaf))
                return;

            LoadInheritance();

            DocTemplateUsage docUsage = (DocTemplateUsage)this.m_conceptleaf;
            if (docUsage.Definition != null)
            {
                this.m_columns = docUsage.Definition.GetParameterRules();
                foreach (DocModelRule rule in this.m_columns)
                {
                    DataGridViewColumn column = new DataGridViewColumn();
                    column.Tag = rule;
                    column.HeaderText = rule.Identification;
                    column.ValueType = typeof(string);//?
                    column.CellTemplate = new DataGridViewTextBoxCell();
                    column.Width = 200;

                    if(rule.IsCondition())
                    {
                        column.HeaderText += "?";
                    }

                    // override cell template for special cases
                    DocConceptRoot docConceptRoot = (DocConceptRoot)this.m_conceptroot;
                    DocEntity docEntity = this.m_project.GetDefinition(docUsage.Definition.Type) as DocEntity;// docConceptRoot.ApplicableEntity;
                    foreach (DocModelRuleAttribute docRule in docUsage.Definition.Rules)
                    {
                        DocAttribute docAttribute = docEntity.ResolveParameterAttribute(docRule, rule.Identification, m_map);
                        if (docAttribute != null)
                        {
                            DocObject docDef = null;
                            if (this.m_map.TryGetValue(docAttribute.DefinedType, out docDef) && docDef is DocDefinition)
                            {
                                if (docDef is DocEnumeration)
                                {
                                    DocEnumeration docEnum = (DocEnumeration)docDef;
                                    DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
                                    cell.MaxDropDownItems = 32;
                                    cell.DropDownWidth = 200;
                                    // add blank item
                                    cell.Items.Add(String.Empty);
                                    foreach (DocConstant docConst in docEnum.Constants)
                                    {
                                        cell.Items.Add(docConst.Name);
                                    }
                                    column.CellTemplate = cell;
                                }
                                else if (docDef is DocEntity || docDef is DocSelect)
                                {
                                    // button to launch dialog for picking entity
                                    DataGridViewButtonCell cell = new DataGridViewButtonCell();
                                    cell.Tag = docDef;
                                    column.CellTemplate = cell;
                                }
                            }
                            else if (docAttribute.DefinedType != null && (docAttribute.DefinedType.Equals("LOGICAL") || docAttribute.DefinedType.Equals("BOOLEAN")))
                            {
                                DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
                                cell.MaxDropDownItems = 4;
                                cell.DropDownWidth = 200;
                                // add blank item
                                cell.Items.Add(String.Empty);
                                cell.Items.Add(Boolean.FalseString);
                                cell.Items.Add(Boolean.TrueString);
                                column.CellTemplate = cell;
                            }
                        }
                    }

                    this.dataGridViewConceptRules.Columns.Add(column);
                }
            }

            // add description column
            DataGridViewColumn coldesc = new DataGridViewColumn();
            coldesc.HeaderText = "Description";
            coldesc.ValueType = typeof(string);//?
            coldesc.CellTemplate = new DataGridViewTextBoxCell();
            coldesc.Width = 400;
            this.dataGridViewConceptRules.Columns.Add(coldesc);

            foreach (DocTemplateItem item in docUsage.Items)
            {
                string[] values = new string[this.dataGridViewConceptRules.Columns.Count];

                if (this.m_columns != null)
                {
                    for (int i = 0; i < this.m_columns.Length; i++)
                    {
                        string parmname = this.m_columns[i].Identification;
                        string val = item.GetParameterValue(parmname);
                        if (val != null)
                        {
                            values[i] = val;
                        }
                    }
                }

                values[values.Length - 1] = item.Documentation;

                int row = this.dataGridViewConceptRules.Rows.Add(values);
                this.dataGridViewConceptRules.Rows[row].Tag = item;

                if(item.Optional)
                {
                    this.dataGridViewConceptRules.Rows[row].DefaultCellStyle.ForeColor = Color.Gray;
                }
            }

            if (this.dataGridViewConceptRules.SelectedCells.Count > 0)
            {
                this.dataGridViewConceptRules.SelectedCells[0].Selected = false;
            }

            m_editcon = false;
        }
コード例 #28
0
        /// <include file='doc\DataGridViewButtonCell.uex' path='docs/doc[@for="DataGridViewButtonCell.Clone"]/*' />
        public override object Clone()
        {
            DataGridViewButtonCell dataGridViewCell;
            Type thisType = this.GetType();

            if (thisType == cellType) //performance improvement
            {
                dataGridViewCell = new DataGridViewButtonCell();
            }
            else
            {
                // SECREVIEW : Late-binding does not represent a security thread, see bug#411899 for more info..
                //
                dataGridViewCell = (DataGridViewButtonCell)System.Activator.CreateInstance(thisType);
            }
            base.CloneInternal(dataGridViewCell);
            dataGridViewCell.FlatStyleInternal = this.FlatStyle;
            dataGridViewCell.UseColumnTextForButtonValueInternal = this.UseColumnTextForButtonValue;
            return dataGridViewCell;
        }
コード例 #29
0
 void UpdateTable()
 {
     dataGridView.Rows.Clear();
     DataGridViewRow row;
     DataGridViewButtonCell button;
     string text;
     foreach(ServiceController controller in ServiceController.GetServices()){
         row = null;
         //try {
         foreach (DataGridViewRow _row in dataGridView.Rows){
             if ((string)_row.Tag == controller.ServiceName)
                 _row.HeaderCell.Value = lauf_variable+"";
         }
         //} catch (Exception) {}
         if (row != null){
             row.HeaderCell.Value = lauf_variable+"";
             row.HeaderCell.Tag = lauf_variable;
             try {
                 addCell(row, 2, controller.Status.ToString(), "", true);
             } catch (Exception) {}
         }
         else {
             row = dataGridView.Rows[dataGridView.Rows.Add()];
             row.HeaderCell.Tag = lauf_variable;
             row.Tag = controller.ServiceName;
             try {
                 addCell(row, 0, controller.ServiceName+"", "", true);
             } catch (Exception) {}
             try {
                 addCell(row, 1, controller.DisplayName, "", true);
             } catch (Exception) {}
             try {
                 addCell(row, 2, controller.Status.ToString(), "", true);
             } catch (Exception) {}
             if (Pausieren.Visible) {
                 try {
                     if (controller.CanPauseAndContinue){
                         button = new DataGridViewButtonCell();
                         if (controller.Status.ToString() == "Running")
                             button.Value = GUITexts.get("Pause");
                         else
                             button.Value = GUITexts.get("Fortsetzen");
                         button.Tag = controller.ServiceName;
                         button.ToolTipText = GUITexts.get("Pause the service")+" " + controller.ServiceName;
                         row.Cells[3] = button;
                     }else
                         addCell(row, 3, "     ", GUITexts.get("Unable to pause the service"), true);
                     if (controller.CanStop){
                         button = new DataGridViewButtonCell();
                         button.Value = GUITexts.get("Stop");
                         button.Tag = controller.ServiceName;
                         button.ToolTipText = GUITexts.get("Stop the service")+" " + controller.ServiceName;
                         row.Cells[4] = button;
                     }
                     else
                         addCell(row, 4, "     ", GUITexts.get("Unable to stop the service"), true);
                     if (controller.CanShutdown){
                         button = new DataGridViewButtonCell();
                         button.Value = GUITexts.get("Abort");
                         button.Tag = controller.ServiceName;
                         button.ToolTipText = GUITexts.get("Abort the service")+" " + controller.ServiceName;
                         row.Cells[5] = button;
                     }
                     else
                         addCell(row, 5, "     ", GUITexts.get("Unable to abort the service"), true);
                 } catch (Exception) {}
             }
             text = "";
             try {
                 foreach(ServiceController contr in controller.DependentServices)
                     text += " " + contr.ServiceName + ";";
                 addCell(row, dataGridView.Rows.Count - 1, text, "", true);
             }
             catch (Exception) {}
             text = "";
             try {
                 foreach(ServiceController contr in controller.ServicesDependedOn)
                     text += " " + contr.ServiceName + ";";
                 addCell(row, dataGridView.Rows.Count - 1, text, "", true);
             }
             catch (Exception) {}
         }
     }
     foreach (DataGridViewRow _row in dataGridView.Rows){
         if((int)_row.HeaderCell.Tag == lauf_variable-1)
             _row.HeaderCell.Value = lauf_variable+"";
         //dataGridView.Rows.Remove(_row);
     }
     lauf_variable++;
 }
コード例 #30
0
ファイル: MainForm.cs プロジェクト: Staubteufel/BulkPDF
        private bool OpenPDF(string pdfPath)
        {
            try
            {
                ResetPDF();
                pdf = new PDF();
                pdf.Open(pdfPath);

                // Fill DataGridView
                tbPDF.Text = pdfPath;
                if (pdf.IsXFA)
                {
                    tbFormTyp.Text = "XFA Form";
                }
                else
                {
                    tbFormTyp.Text = "Acroform";
                }
                foreach (PDFField pdfField in pdf.ListFields())
                {
                    dgvBulkPDF.Rows.Add();
                    int row = dgvBulkPDF.Rows.Count - 1;

                    dgvBulkPDF.Rows[row].Cells["ColField"].Value = pdfField.Name;
                    dgvBulkPDF.Rows[row].Cells["ColTyp"].Value = pdfField.Typ;
                    dgvBulkPDF.Rows[row].Cells["ColValue"].Value = pdfField.CurrentValue;
                    pdfFields.Add(pdfField.Name, pdfField);

                    var dgvButtonCell = new DataGridViewButtonCell();
                    dgvButtonCell.Value = Properties.Resources.CellButtonSelect;
                    dgvBulkPDF.Rows[row].Cells["ColOption"] = dgvButtonCell;
                }

                return true;
            }
            catch (Exception ex)
            {
                ExceptionHandler.Throw(String.Format(Properties.Resources.ExceptionPDFIsCorrupted, pdfPath), ex.ToString());
                ResetPDF();
            }
            return false;
        }
コード例 #31
0
        private void CargarDGV(DataGridView dgv)
        {
            int canCargos = dgv.RowCount;
            DataGridViewRow fila;
            DataGridViewRow insr;            
            int cant;

            DataGridViewCell cel = new DataGridViewTextBoxCell();
            cel.Style.BackColor = System.Drawing.Color.Black;

            DataGridViewCell cel2;
            

            DataGridViewButtonCell celBut;            
                        

            for (int i = 0; i < canCargos; i++)
            {
                fila = dgv.Rows[i];
                
                object[] param = { fila.Cells[0].Value , fila.Cells[2].Value, fila.Cells[3].Value, fila.Cells[4].Value, fila.Cells[5].Value, fila.Cells[6].Value, fila.Cells[7].Value, fila.Cells[8].Value};
                insr = new DataGridViewRow();                
                insr.CreateCells(dgvPlan, param);
                insr.Cells[8].Style.BackColor = System.Drawing.Color.Gray;
                dgvPlan.Rows.Add(insr);

                cant = int.Parse(fila.Cells[1].Value.ToString());

                fila = dgv.Rows[++i];
                insr = new DataGridViewRow();
                object[] param2 = { "", fila.Cells[2].Value, fila.Cells[3].Value, fila.Cells[4].Value, fila.Cells[5].Value, fila.Cells[6].Value, fila.Cells[7].Value, fila.Cells[8].Value};
                insr.CreateCells(dgvPlan,param2 );
                insr.Cells[0].Style.BackColor = System.Drawing.Color.Gray;

                celBut = new DataGridViewButtonCell();
                celBut.Value = "Asignar";
                celBut.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                insr.Cells[8] = celBut;
                
                dgvPlan.Rows.Add(insr);
                cant--;

                insr = new DataGridViewRow();
                
                insr.Height = 5;
                insr.DefaultCellStyle = cel.Style;
                cel2 = new DataGridViewTextBoxCell();
                cel2.Style.BackColor = System.Drawing.Color.Black;
                insr.Cells.Add(cel2);

                dgvPlan.Rows.Add(insr);


                while (cant > 0 )
                {
                    insr = new DataGridViewRow();
                    insr.CreateCells(dgvPlan, param);
                    insr.Cells[8].Style.BackColor = System.Drawing.Color.Gray;
                    dgvPlan.Rows.Add(insr);
                    
                    insr = new DataGridViewRow();
                    insr.CreateCells(dgvPlan, param2);
                    insr.Cells[0].Style.BackColor = System.Drawing.Color.Gray;

                    celBut = new DataGridViewButtonCell();
                    celBut.Value = "Asignar";
                    celBut.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    insr.Cells[8] = celBut;
                    
                    dgvPlan.Rows.Add(insr);
                    cant--;

                    insr = new DataGridViewRow();
                    insr.Height = 5;

                    insr.DefaultCellStyle = cel.Style;
                    cel2 = new DataGridViewTextBoxCell();
                    cel2.Style.BackColor = System.Drawing.Color.Black;
                    insr.Cells.Add(cel2);
                    insr.DefaultCellStyle = cel.Style;
                    
                    dgvPlan.Rows.Add(insr);

                }
            }
        }
コード例 #32
0
        private void listBoxTasks_SelectedIndexChanged(object sender, EventArgs e)
        {
            ITask task = MyJob.Tasks.Skip(listBoxTasks.SelectedIndex).Take(1).FirstOrDefault();

            DGTasks.Rows.Clear();

            DGTasks.Rows.Add("Name", task.Name);

            int i = DGTasks.Rows.Add("Configuration", "");
            DataGridViewButtonCell btn = new DataGridViewButtonCell();
            DGTasks.Rows[i].Cells[1] = btn;
            DGTasks.Rows[i].Cells[1].Value = "See clear value";
            DGTasks.Rows[i].Cells[1].Tag = task.GetClearConfiguration();

            i = DGTasks.Rows.Add("Body", "");
            btn = new DataGridViewButtonCell();
            DGTasks.Rows[i].Cells[1] = btn;
            DGTasks.Rows[i].Cells[1].Value = "See value";
            DGTasks.Rows[i].Cells[1].Tag = task.TaskBody;

            DGTasks.Rows.Add("Id", task.Id);
            DGTasks.Rows.Add("State", task.State);
            DGTasks.Rows.Add("Priority", task.Priority);
            if (task.StartTime != null) DGTasks.Rows.Add("Start Time", ((DateTime)task.StartTime).ToLocalTime().ToString("G"));
            if (task.EndTime != null) DGTasks.Rows.Add("End Time", ((DateTime)task.EndTime).ToLocalTime().ToString("G"));
            DGTasks.Rows.Add("Progress", task.Progress);
            DGTasks.Rows.Add("Duration", task.RunningDuration);
            DGTasks.Rows.Add("Perf Message", task.PerfMessage);
            DGTasks.Rows.Add("Encryption Key Id", task.EncryptionKeyId);
            DGTasks.Rows.Add("Encryption Scheme", task.EncryptionScheme);
            DGTasks.Rows.Add("Encryption Version", task.EncryptionVersion);

            // let's get the name of the processor
            IMediaProcessor processor = JobInfo.GetMediaProcessorFromId(task.MediaProcessorId, _context);
            DGTasks.Rows.Add("Mediaprocessor Id", task.MediaProcessorId);
            if (processor != null) DGTasks.Rows.Add("Mediaprocessor Name", processor.Name);

            DGTasks.Rows.Add("Options", task.Options);
            DGTasks.Rows.Add("Initialization Vector", task.InitializationVector);

            string sid = "";
            if (task.InputAssets.Count() > 1) sid = " #{0}"; else sid = "";
            for (int j = 0; j < task.InputAssets.Count(); j++)
            {
                DGTasks.Rows.Add("Input asset" + string.Format(sid, j + 1) + " Name", task.InputAssets[j].Name);
                DGTasks.Rows.Add("Input asset" + string.Format(sid, j + 1) + " Id", task.InputAssets[j].Id);
            }

            if (task.OutputAssets.Count() > 1) sid = " #{0}"; else sid = "";
            for (int j = 0; j < task.OutputAssets.Count(); j++)
            {
                DGTasks.Rows.Add("Output asset" + string.Format(sid, j + 1) + " Name", task.OutputAssets[j].Name);
                DGTasks.Rows.Add("Output asset" + string.Format(sid, j + 1) + " Id", task.OutputAssets[j].Id);
            }

            TaskSizeAndPrice taskSizePrice = JobInfo.CalculateTaskSizeAndPrice(task, _context);
            if ((taskSizePrice.InputSize != -1) && (taskSizePrice.OutputSize != -1))
            {
                DGTasks.Rows.Add("Input size", AssetInfo.FormatByteSize(taskSizePrice.InputSize));
                DGTasks.Rows.Add("Output size", AssetInfo.FormatByteSize(taskSizePrice.OutputSize));
                DGTasks.Rows.Add("Processed size", AssetInfo.FormatByteSize(taskSizePrice.InputSize + taskSizePrice.OutputSize));
                if (taskSizePrice.Price != -1) DGTasks.Rows.Add("Estimated price", string.Format("{0} {1:0.00}", Properties.Settings.Default.Currency, taskSizePrice.Price));
            }
            else
            {
                DGTasks.Rows.Add("Input/output size", "undefined, task did not finish or one of the assets has been deleted");

            }

            for (int j = 0; j < task.ErrorDetails.Count(); j++)
            {
                DGTasks.Rows.Add("Error", task.ErrorDetails[j].Code + ": " + task.ErrorDetails[j].Message);

            }
        }
コード例 #33
0
ファイル: PurchaseForm.cs プロジェクト: nburd/economy
 private void UpdateDataGrid()
 {
     purchaseDataGridView.Rows.Clear();
     using (var db = new Model.BudgetModel())
     {
         var purchases = db.Purchases.ToList();
         var renameButton = new DataGridViewButtonCell();
         var removeButton = new DataGridViewButtonCell();
         foreach (var purchase in purchases)
         {
             var chekItems = db.Purchases.Find(purchase.Id).ChekItems.ToList();
             if (chekItems.Count == 0)
             {
                 db.Purchases.Remove(purchase);
                 db.SaveChanges();
             }
             else
                 purchaseDataGridView.Rows.Add(
                     purchase.Id,
                     purchase.DateTime,
                     purchase.Source.Name,
                     renameButton,
                     removeButton
                 );
         }
     }
 }