private void SynchCheckedItemsOnItemsChanged(NotifyCollectionChangedEventArgs args) { //// We only need to synch when an item is removed or replaced. In case of adding a new //// item we would need to synch if the ItemCheckedPath is defined but since the //// ListSoruce's view model factory does this, we omit this check here. switch (args.Action) { case NotifyCollectionChangedAction.Remove: DataSourceItem newItem = args.OldItems[0] as DataSourceItem; if (newItem.isChecked) { this.checkedItems.UncheckItemSilently(newItem, false, false); } break; case NotifyCollectionChangedAction.Replace: { if (!string.IsNullOrEmpty(this.itemCheckedPathCache)) { newItem = args.NewItems[0] as DataSourceItem; if (newItem != null) { this.listSourceFactory.InitializeItemCheckedState(newItem); } } } break; } }
public void GetDataSources_Reporter(DataSourceItem dataSource) { if (dataSource != null) { actualDataSourceItems.Add(dataSource); } }
/// <summary> /// Adds the specified item. /// </summary> /// <param name="item">The item.</param> public void Add(T item) { if (this.IsReadOnly) { throw new InvalidOperationException("Collection cannot be modified because it is read-only. This is because the ItemCheckedPath property does not have a setter."); } if (!this.owner.OnItemCheckedStateChanging(this.GetDataItem(item), true)) { DataSourceItem handledItem = item as DataSourceItem; if (handledItem == null) { handledItem = this.owner.ListSource.FindItem(item) as DataSourceItem; } if (handledItem == null) { throw new InvalidOperationException("Item is not part of the source collection."); } if (handledItem.isChecked) { throw new InvalidOperationException("Item already checked."); } this.SetItemCheckedState(handledItem, true, true, true, CheckedItemsCollectionOperation.Add); this.items.Add(handledItem); this.OnNotifyCollectionChanged(NotifyCollectionChangedAction.Add, null, item, this.Count - 1); this.owner.OnItemCheckedStateChanged(item, true); } }
private void SaveButton_Click(object sender, EventArgs e) { if (graphList == null || graphList.XenObject == null) { return; } designedGraph.DisplayName = GraphNameTextBox.Text; if (isNew) { graphList.AddGraph(designedGraph); } else { graphList.ReplaceGraphAt(graphList.SelectedGraphIndex, designedGraph); } List <DataSourceItem> dataSources = new List <DataSourceItem>(); foreach (DataGridViewRow row in dataGridView.Rows) { DataSourceItem dsi = ((DataSourceGridViewRow)row).Dsi; if (dsi.ColorChanged) { Palette.SetCustomColor(Palette.GetUuid(dsi.DataSource.name_label, graphList.XenObject), dsi.Color); } dataSources.Add(dsi); } graphList.SaveGraphs(dataSources); }
private void UpdateObjects(DataSourceItem d) { string folder = vp.GetProjectFolder() + "\\" + "Properties\\DataSources"; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string file = d.FullName + ".datasource"; string b = AppDomain.CurrentDomain.BaseDirectory; string c = b + "Templates\\datasource"; string e = c + "\\" + "d.datasource"; string cc = File.ReadAllText(e); cc = cc.Replace("<...>", d.TypeName); cc = cc.Replace("<....>", d.AssemblyQualifiedName); FileStream fs = File.Create(folder + "\\" + file, 10000, FileOptions.None); fs.Close(); File.WriteAllText(folder + "\\" + file, cc); vp.AddDataSource(file); }
private void LoadFromFile(DataGroupItem dataGroup, DataSourceItem sourceItem) { FileCentralDataSource ds = sourceItem.SourceInformation as FileCentralDataSource; TimeSeries[] allTS = (TimeSeries[])NonInteractiveIO.Load(ds.Filename); if (allTS == null) { return; } for (var i = 0; i < allTS.Length; i++) { var ts = allTS[i]; DataDetailsItem dataItem = new DataDetailsItem { Data = new TimeSeriesPersistent { TimeSeries = ts }, DataInformation = new FileDataDetails { Name = ts.name, ReloadOnRun = ReloadOnRun, Column = i #if V3 || V4_0 || V4_1 || V4_2 #else , StartDate = ts.Start #endif } }; sourceItem.Data.Add(dataItem); var gdd = new GenericDataDetails { Name = ts.name }; gdd.AssociatedData.Add(dataItem); dataGroup.DataDetails.Add(gdd); } }
private void ImportDataObjects(ArrayList L, bool append = false) { if (append == false) { P = L; } //ShowInfoPanel(true); //MessageBox.Show("objects - " + L.Count); g.Nodes.Clear(); foreach (TreeNode ns in L) { TreeNode ng = new TreeNode(ns.Text); g.Nodes.Add(ng); DataSourceItem d = ns.Tag as DataSourceItem; if (d != null) { ng.Text = d.Namespace + " - " + d.TypeName; UpdateObjects(d); P.Add(d); } } }
private void OnItemCheckedPathChanged(DependencyPropertyChangedEventArgs args) { this.checkedItems.ClearSilently(false); string newValue = args.NewValue as string; this.itemCheckedPathCache = newValue; this.listSourceFactory.itemCheckedPropInfo = null; this.listSourceFactory.sourceItemCheckedPathWritable = null; if (string.IsNullOrEmpty(this.itemCheckedPathCache)) { return; } DataSourceItem item = this.ListSource.GetFirstItem() as DataSourceItem; while (item != null) { this.listSourceFactory.InitializeItemCheckedState(item); item = item.Next as DataSourceItem; } RadVirtualizingDataControlItem[] containers = this.RealizedContainers; foreach (RadDataBoundListBoxItem container in containers) { container.SynchCheckBoxEnabledState(); } }
public string WriteDataSource(DataSourceItem dataSourceItem) { if (dataSourceItem == null) { throw new ArgumentNullException("dataSourceItem"); } if (!this.mReportRepository.ValidatePath(dataSourceItem.Path)) { throw new InvalidPathException(dataSourceItem.Path); } string name = dataSourceItem.Name; string parentPath = SSRSUtil.GetParentPath(dataSourceItem); if (!this.mOverwrite) { if (this.mReportRepository.ItemExists(dataSourceItem.Path, "DataSource")) { throw new ItemAlreadyExistsException(dataSourceItem.Path); } } return(this.mReportRepository.WriteDataSource(parentPath, dataSourceItem, this.mOverwrite)); }
public void GetDataSourceItem_PathDoesntExist() { string dsPath = "/SSRSMigrate_AW_Tests/Data Sources/Test Data Source Doesnt Exist"; DataSourceItem actual = reader.GetDataSource(dsPath); Assert.IsNull(actual); }
private void UpdateContainerVisualState(DataSourceItem item) { RadDataBoundListBoxItem container = this.owner.GetContainerFromDataSourceItem(item) as RadDataBoundListBoxItem; if (container != null) { container.UpdateCheckedState(); } }
public DataSourceItem GetDataSource(CatalogItem item, DataSourceDefinition definition) { if (item == null) { throw new ArgumentNullException("item"); } if (definition == null) { throw new ArgumentNullException("definition"); } DataSourceItem ds = new DataSourceItem(); ds.Name = item.Name; ds.Path = item.Path; ds.CreatedBy = item.CreatedBy; ds.CreationDate = item.CreationDate; ds.Description = item.Description; ds.ID = item.ID; ds.ModifiedBy = item.ModifiedBy; ds.ModifiedDate = item.ModifiedDate; ds.Size = item.Size; ds.VirtualPath = item.VirtualPath; ds.ConnectString = definition.ConnectString; switch (definition.CredentialRetrieval) { case CredentialRetrievalEnum.Integrated: ds.CredentialsRetrieval = "Integrated"; break; case CredentialRetrievalEnum.None: ds.CredentialsRetrieval = "None"; break; case CredentialRetrievalEnum.Prompt: ds.CredentialsRetrieval = "Prompt"; break; case CredentialRetrievalEnum.Store: ds.CredentialsRetrieval = "Store"; break; } ds.Enabled = definition.Enabled; ds.EnabledSpecified = definition.EnabledSpecified; ds.Extension = definition.Extension; ds.ImpersonateUser = definition.ImpersonateUser; ds.ImpersonateUserSpecified = definition.ImpersonateUserSpecified; ds.OriginalConnectStringExpressionBased = ds.OriginalConnectStringExpressionBased; ds.Password = definition.Password; ds.Prompt = definition.Prompt; ds.UseOriginalConnectString = definition.UseOriginalConnectString; ds.UserName = definition.UserName; ds.WindowsCredentials = definition.WindowsCredentials; return(ds); }
private void CheckItem(DataSourceItem item) { if (!item.isChecked && !this.owner.OnItemCheckedStateChanging(item.Value, true)) { this.SetItemCheckedState(item, true, true, true, CheckedItemsCollectionOperation.Add); this.items.Add(item); this.OnNotifyCollectionChanged(NotifyCollectionChangedAction.Add, null, item.Value, this.items.Count - 1); this.owner.OnItemCheckedStateChanged(item.Value, true); } }
/// <summary> /// Checks the item silently, i.e. without firing the <see cref="RadDataBoundListBox.ItemCheckedStateChanging"/> event. /// </summary> internal void CheckItemSilently(DataSourceItem item, bool updateContainerState, bool synchWithSource) { if (!item.isChecked) { this.SetItemCheckedState(item, true, updateContainerState, synchWithSource, CheckedItemsCollectionOperation.Add); this.items.Add(item); this.OnNotifyCollectionChanged(NotifyCollectionChangedAction.Add, null, item.Value, this.items.Count - 1); this.owner.OnItemCheckedStateChanged(item.Value, true); } }
private void UncheckItem(DataSourceItem item) { if (item.isChecked && !this.owner.OnItemCheckedStateChanging(item.Value, false)) { this.SetItemCheckedState(item, false, true, true, CheckedItemsCollectionOperation.Remove); int indexOfItem = this.items.IndexOf(item); this.items.RemoveAt(indexOfItem); this.OnNotifyCollectionChanged(NotifyCollectionChangedAction.Remove, null, item.Value, indexOfItem); this.owner.OnItemCheckedStateChanged(item.Value, false); } }
/// <summary> /// Creates a <see cref="T:Telerik.Core.Data.IDataSourceItem"/> instance. /// </summary> public IDataSourceItem CreateItem(RadListSource owner, object value) { DataSourceItem newItem = new DataSourceItem(owner, value); if (!string.IsNullOrEmpty(this.owner.itemCheckedPathCache)) { this.InitializeItemCheckedState(newItem); } return(newItem); }
private object GetDataItem(object item) { DataSourceItem typedItem = item as DataSourceItem; if (typedItem != null) { return(typedItem.Value); } return(item); }
public void ImportItem_DeserializeException() { ImportStatus status = null; DataSourceItem actual = importer.ImportItem(expectedAWDataSource_DeserializeException_FileName, out status); Assert.IsNull(actual); Assert.IsFalse(status.Success); Assert.AreEqual("Unexpected end when deserializing object. Path 'Password', line 10, position 20.", status.Error.Message); }
/// <summary> /// Unchecks the item silently, i.e. without firing the <see cref="RadDataBoundListBox.ItemCheckedStateChanging"/> event. /// </summary> internal void UncheckItemSilently(DataSourceItem item, bool updateContainerState, bool syncWithSource) { if (item.isChecked) { this.SetItemCheckedState(item, false, updateContainerState, syncWithSource, CheckedItemsCollectionOperation.Remove); int indexOfItem = this.items.IndexOf(item); this.items.RemoveAt(indexOfItem); this.OnNotifyCollectionChanged(NotifyCollectionChangedAction.Remove, item.Value, null, indexOfItem); this.owner.OnItemCheckedStateChanged(item.Value, false); } }
public void ImportItem_AWDataSource() { ImportStatus status = null; DataSourceItem actual = importer.ImportItem(expectedAWDataSourceFileName, out status); Assert.NotNull(actual); Assert.NotNull(status); Assert.AreEqual(actual.Name, expectedAWDataSourceItem.Name); Assert.AreEqual(actual.Path, expectedAWDataSourceItem.Path); Assert.True(status.Success); }
/// <summary> /// Create a new instance of frmImageColumns /// </summary> /// <param name="dc">The collection to edit</param> /// <param name="owner">The owner of collection</param> public frmImageColumns(DataSourceImageColumnCollections dc, DataSourceItem owner) { InitializeComponent(); imagecollectionedit = new DataSourceImageColumnCollections(owner, typeof(DataSourceImageColumnItem));//����һ��copy foreach (DataSourceImageColumnItem di in dc) { DataSourceImageColumnItem diedit = new DataSourceImageColumnItem(); diedit.ColumnName = di.ColumnName; diedit.DefaultPath = di.DefaultPath; imagecollectionedit.Add(diedit); } }
private void InitPage() { _cmbDataSource.SelectedIndex = -1; _cmbDataSource.Items.Clear(); _currentDataSource = null; _cmbDataMember.SelectedIndex = -1; _cmbDataMember.Items.Clear(); _cmbLabelField.SelectedIndex = -1; _cmbLabelField.Items.Clear(); _xLists.Clear(); _dataSourceDirty = false; }
/// <summary> /// Initializes the page before it can be loaded with the component. /// </summary> private void InitPage() { _dataSourceCombo.SelectedIndex = -1; _dataSourceCombo.Items.Clear(); _currentDataSource = null; _dataMemberCombo.SelectedIndex = -1; _dataMemberCombo.Items.Clear(); _dataTextFieldCombo.SelectedIndex = -1; _dataTextFieldCombo.Items.Clear(); _dataValueFieldCombo.SelectedIndex = -1; _dataValueFieldCombo.Items.Clear(); _dataSourceDirty = false; }
public void ImportItem_DeserializeException() { string filename = Path.Combine(this.GetTestDataPath(), dataSourceItemFilename_DeserializeError_Filename); ImportStatus status = null; DataSourceItem actual = importer.ImportItem(filename, out status); Assert.IsNull(actual); Assert.IsFalse(status.Success); Assert.AreEqual("Unexpected end when deserializing object. Path 'Password', line 10, position 19.", status.Error.Message); }
private void OnListSource_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e) { if (this.isInternalCheckModeSync) { return; } if (e.PropertyName.Equals(this.itemCheckedPathCache)) { DataSourceItem item = this.ListSource.FindItem(e.Item) as DataSourceItem; this.listSourceFactory.InitializeItemCheckedState(item); } }
public void ImportItem() { string filename = Path.Combine(this.GetTestDataPath(), dataSourceItemFilename); ImportStatus status = null; DataSourceItem actual = importer.ImportItem(filename, out status); Assert.NotNull(actual); Assert.NotNull(status); Assert.AreEqual(actual.Name, expectedDataSourceItem.Name); Assert.AreEqual(actual.Path, expectedDataSourceItem.Path); Assert.True(status.Success); }
private static void CreateDataSource(ReportingService2010 reportingService, DataSourceItem dataSource) { if (reportingService == null) { throw new ArgumentNullException("reportingService"); } if (dataSource == null) { throw new ArgumentNullException("dataSource"); } DataSourceDefinition def = new DataSourceDefinition(); def.ConnectString = dataSource.ConnectString; switch (dataSource.CredentialsRetrieval) { case "Integrated": def.CredentialRetrieval = CredentialRetrievalEnum.Integrated; break; case "None": def.CredentialRetrieval = CredentialRetrievalEnum.None; break; case "Prompt": def.CredentialRetrieval = CredentialRetrievalEnum.Prompt; break; case "Store": def.CredentialRetrieval = CredentialRetrievalEnum.Store; break; } def.Enabled = dataSource.Enabled; def.EnabledSpecified = dataSource.EnabledSpecified; def.Extension = dataSource.Extension; def.ImpersonateUser = dataSource.ImpersonateUser; def.ImpersonateUserSpecified = dataSource.ImpersonateUserSpecified; def.OriginalConnectStringExpressionBased = dataSource.OriginalConnectStringExpressionBased; def.Password = dataSource.Password; def.Prompt = dataSource.Prompt; def.UseOriginalConnectString = dataSource.UseOriginalConnectString; def.UserName = dataSource.UserName; def.WindowsCredentials = dataSource.WindowsCredentials; string parent = TesterUtility.GetParentPath(dataSource.Path); ReportingService2010TestEnvironment.CreateFolderFromPath(reportingService, parent); reportingService.CreateDataSource(dataSource.Name, parent, true, def, null); }
/// <summary> /// Synchronizes the IsChecked state of the <see cref="DataSourceItem"/> instance /// with the value of the property on the /// source object defined by the <see cref="RadDataBoundListBox.ItemCheckedPath"/>. /// </summary> internal void InitializeItemCheckedState(DataSourceItem item) { bool isChecked = this.GetIsCheckedValue(item.Value); CheckedItemsCollection <object> checkedItems = this.owner.CheckedItems; if (isChecked) { checkedItems.CheckItemSilently(item, true, false); } else if (item.isChecked) { checkedItems.UncheckItemSilently(item, true, false); } }
/// <summary> /// Checks all unchecked items from the data source bound to the current <see cref="RadDataBoundListBox"/> instance. /// </summary> public void CheckAll() { if (this.IsReadOnly) { throw new InvalidOperationException("Collection cannot be modified because it is read-only. This is because the ItemCheckedPath property does not have a setter."); } DataSourceItem item = this.owner.ListSource.GetFirstItem() as DataSourceItem; while (item != null) { this.CheckItem(item); item = item.Next as DataSourceItem; } }
/// <include file='doc\DataGridGeneralPage.uex' path='docs/doc[@for="DataGridGeneralPage.InitPage"]/*' /> /// <devdoc> /// Initializes the page before it can be loaded with the component. /// </devdoc> private void InitPage() { dataSourceCombo.SelectedIndex = -1; dataSourceCombo.Items.Clear(); currentDataSource = null; dataMemberCombo.SelectedIndex = -1; dataMemberCombo.Items.Clear(); dataKeyFieldCombo.SelectedIndex = -1; dataKeyFieldCombo.Items.Clear(); dataSourceDirty = false; showHeaderCheck.Checked = false; showFooterCheck.Checked = false; allowSortingCheck.Checked = false; }
internal void AddToGroup(RiverSystemScenario scenario, DataGroupItem dataGroup, int index) { DataSourceItem sourceItem = dataGroup.InputSetItems[index].DataSource; sourceItem.Name = Name; if (DetailsAsCSV == null) { LoadFromFile(dataGroup, sourceItem); } else { LoadFromDetails(dataGroup, sourceItem); } }
protected override void LoadComponent() { this.InitPage(); ObjectList baseControl = base.GetBaseControl(); this.LoadDataSourceItems(); if (this._cmbDataSource.Items.Count > 0) { ObjectListDesigner baseDesigner = (ObjectListDesigner) base.GetBaseDesigner(); string dataSource = baseDesigner.DataSource; if (dataSource != null) { int count = this._cmbDataSource.Items.Count; for (int i = 1; i < count; i++) { DataSourceItem item = (DataSourceItem) this._cmbDataSource.Items[i]; if (string.Compare(item.Name, dataSource, true) == 0) { this._cmbDataSource.SelectedIndex = i; this._currentDataSource = item; this.LoadDataMembers(); if (this._currentDataSource is ListSourceDataSourceItem) { string dataMember = baseDesigner.DataMember; this._cmbDataMember.SelectedIndex = this._cmbDataMember.FindStringExact(dataMember); if (this._cmbDataMember.IsSet()) { ((ListSourceDataSourceItem) this._currentDataSource).CurrentDataMember = dataMember; } } this.LoadDataSourceFields(); break; } } } } string s = baseControl.get_LabelField(); if (s.Length != 0) { int num3 = this._cmbLabelField.FindStringExact(s); this._cmbLabelField.SelectedIndex = num3; } this._txtItemCount.Text = baseControl.get_ItemCount().ToString(); this._txtItemsPerPage.Text = baseControl.get_ItemsPerPage().ToString(); this._txtBackCommandText.Text = baseControl.get_BackCommandText(); this._txtDetailsCommandText.Text = baseControl.get_DetailsCommandText(); this._txtMoreText.Text = baseControl.get_MoreText(); this.UpdateEnabledVisibleState(); }
private void AddDataSourceItem(DataSourceItem di) { string caption = di.Caption; string datamemeber = di.DataMember; Image imgvalue = OfficeTools.Properties.Resources.value; if (caption.Length > 0) { ToolStripMenuItem tmdataset = new ToolStripMenuItem(caption, imgvalue); if (di.GetTable().Contains(di.DataMember)) { for (int i = 0; i < ((DataView)di.GetTable()[di.DataMember]).Table.Columns.Count; i++) { string column = (((DataView)di.GetTable()[di.DataMember]).Table.Columns[i]).ColumnName; ToolStripMenuItem tmcolumn = new ToolStripMenuItem(column, imgvalue); tmcolumn.Tag = column; tmcolumn.Click += new EventHandler(stripMenuItem_Click); tmdataset.DropDownItems.Add(tmcolumn); } } this.dataSourceItemToolStripMenuItem.DropDownItems.Add(tmdataset); } }
private void InitPage() { this._dataSourceCombo.SelectedIndex = -1; this._dataSourceCombo.Items.Clear(); this._currentDataSource = null; this._dataMemberCombo.SelectedIndex = -1; this._dataMemberCombo.Items.Clear(); this._dataTextFieldCombo.SelectedIndex = -1; this._dataTextFieldCombo.Items.Clear(); this._dataValueFieldCombo.SelectedIndex = -1; this._dataValueFieldCombo.Items.Clear(); this._dataSourceDirty = false; }
protected override void LoadComponent() { this.InitPage(); this.LoadDataSourceItems(); IListDesigner baseDesigner = (IListDesigner) base.GetBaseDesigner(); if (this._dataSourceCombo.Items.Count > 0) { string dataSource = baseDesigner.DataSource; if (dataSource != null) { int count = this._dataSourceCombo.Items.Count; for (int i = 1; i < count; i++) { DataSourceItem item = (DataSourceItem) this._dataSourceCombo.Items[i]; if (string.Compare(item.Name, dataSource, true) == 0) { this._dataSourceCombo.SelectedIndex = i; this._currentDataSource = item; this.LoadDataMembers(); if (this._currentDataSource is ListSourceDataSourceItem) { string dataMember = baseDesigner.DataMember; this._dataMemberCombo.SelectedIndex = this._dataMemberCombo.FindStringExact(dataMember); if (this._dataMemberCombo.IsSet()) { ((ListSourceDataSourceItem) this._currentDataSource).CurrentDataMember = dataMember; } } this.LoadDataSourceFields(); break; } } } } string dataTextField = baseDesigner.DataTextField; string dataValueField = baseDesigner.DataValueField; if (dataTextField.Length != 0) { int num3 = this._dataTextFieldCombo.FindStringExact(dataTextField); this._dataTextFieldCombo.SelectedIndex = num3; } if (dataValueField.Length != 0) { int num4 = this._dataValueFieldCombo.FindStringExact(dataValueField); this._dataValueFieldCombo.SelectedIndex = num4; } if (this._isBaseControlList) { List baseControl = base.GetBaseControl(); this._itemCountTextBox.Text = baseControl.get_ItemCount().ToString(); this._itemsPerPageTextBox.Text = baseControl.get_ItemsPerPage().ToString(); switch (baseControl.get_Decoration()) { case 0: this._decorationCombo.SelectedIndex = 0; goto Label_0282; case 1: this._decorationCombo.SelectedIndex = 1; goto Label_0282; case 2: this._decorationCombo.SelectedIndex = 2; goto Label_0282; } } else { SelectionList list2 = base.GetBaseControl(); switch (list2.get_SelectType()) { case 0: this._selectTypeCombo.SelectedIndex = 0; break; case 1: this._selectTypeCombo.SelectedIndex = 1; break; case 2: this._selectTypeCombo.SelectedIndex = 2; break; case 3: this._selectTypeCombo.SelectedIndex = 3; break; case 4: this._selectTypeCombo.SelectedIndex = 4; break; } this._rowsTextBox.Text = list2.get_Rows().ToString(); } Label_0282: this.UpdateEnabledVisibleState(); }
private List<DataSourceItem> ConvertToDataSource(List<QueueDownloadItem> DownloadItems) { List<DataSourceItem> results = new List<DataSourceItem>(); foreach (var item in DownloadItems) { foreach (var item1 in item.SelectedChapters) { var dsItem = new DataSourceItem() { StoryName = item.StoryName, ProviderName = item.ProviderName, //Progress = (new Random()).Next(1,100), ChapterUrl = item1.Url, ChapterName = item1.Name, Pages = item1.PageCount, Size = item1.Size.ToKB(), Identify = item1.UniqueIdentify }; if (item1.Status != DownloadStatus.Downloading) { dsItem.Status = item1.Status.ToString(); } else { dsItem.Status = ((float)item1.DownloadedCount / item1.PageCount).ToString("p"); if(dsItem.Status =="NaN") dsItem.Status = "Initializing..."; } results.Add(dsItem); } } return results; }
private bool SaveDataSource() { int rowcount = dataGridViewDataSource.Rows.Count; OfficePlate platenew = new OfficePlate(); for (int i = 0; i < rowcount - 1; i++) { DataSourceItem di = new DataSourceItem(); object objcaption = dataGridViewDataSource.Rows[i].Cells["ColumnCaption"].Value; if (objcaption == null || objcaption.ToString().Trim().Length == 0) { MessageBox.Show("Caption can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } di.Caption = objcaption.ToString(); object objdatasource = dataGridViewDataSource.Rows[i].Cells["ColumnDataSource"].Value; if (objdatasource == null || objdatasource.ToString().Trim().Length == 0) { MessageBox.Show("DataSource can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } di.DataSource = DesignerHost.Container.Components[objdatasource.ToString()]; object objdatamember = dataGridViewDataSource.Rows[i].Cells["ColumnDataMember"].Value; if (objdatamember == null || objdatamember.ToString().Trim().Length == 0) { MessageBox.Show("DataMember can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } di.DataMember = objdatamember.ToString(); DataSourceImageColumnCollections dc = dataGridViewDataSource.Rows[i].Cells["ColumnImageColumns"].Tag as DataSourceImageColumnCollections; for (int j = 0; j < dc.Count; j++) { di.ImageColumns.Add(dc[j]); } platenew.DataSource.Add(di); } IComponentChangeService ComponentChangeService = this.DesignerHost.GetService(typeof(IComponentChangeService)) as IComponentChangeService; object oldValue = null; object newValue = null; PropertyDescriptor desDataSource = TypeDescriptor.GetProperties(plate)["DataSource"]; ComponentChangeService.OnComponentChanging(this.plate, desDataSource); oldValue = plate.DataSource; plate.DataSource = platenew.DataSource; newValue = plate.DataSource; ComponentChangeService.OnComponentChanged(plate, desDataSource, oldValue, newValue); tabPageDataSource.Text = "DataSource Defination"; btnSaveDataSource.Enabled = false; btnUndoDataSource.Enabled = false; return true; }
private void LoadDataSourceItems() { this._cmbDataSource.EnsureNotSetItem(); ISite site = base.GetSelectedComponent().Site; if (site != null) { IContainer service = (IContainer) site.GetService(typeof(IContainer)); if (service != null) { ComponentCollection components = service.Components; if (components != null) { foreach (IComponent component in components) { if (!(component is IEnumerable) && !(component is IListSource)) { continue; } ISite site2 = component.Site; if (((site2 != null) && (site2.Name != null)) && (site2.Name.Length != 0)) { DataSourceItem item; if (component is IListSource) { IListSource runtimeListSource = (IListSource) component; item = new ListSourceDataSourceItem(site2.Name, runtimeListSource); } else { IEnumerable runtimeDataSource = (IEnumerable) component; item = new DataSourceItem(site2.Name, runtimeDataSource); } this._cmbDataSource.AddItem(item); } } } } } }
private void OnSelChangedDataSource(object source, EventArgs e) { if (!base.IsLoading()) { DataSourceItem selectedItem = null; if (this._cmbDataSource.IsSet()) { selectedItem = (DataSourceItem) this._cmbDataSource.SelectedItem; } if ((selectedItem != null) && !selectedItem.IsSelectable()) { using (new MobileComponentEditorPage.LoadingModeResource(this)) { if (this._currentDataSource == null) { this._cmbDataSource.SelectedIndex = -1; } else { this._cmbDataSource.SelectedItem = this._currentDataSource; } } } else { this._currentDataSource = selectedItem; if (this._currentDataSource is ListSourceDataSourceItem) { ((ListSourceDataSourceItem) this._currentDataSource).CurrentDataMember = null; } this._dataSourceDirty = true; this.LoadDataMembers(); this.LoadDataSourceFields(); this.SetDirty(); this.UpdateEnabledVisibleState(); } } }
public DataSourceGridViewRow(DataSourceItem dataSourceItem, bool displayOnGraph) { this.dsi = dataSourceItem; var displayOnGraphCell = new DataGridViewCheckBoxCell { Value = displayOnGraph }; var datasourceCell = new DataGridViewTextBoxCell { Value = dsi.ToString() }; var typeCell = new DataGridViewTextBoxCell { Value = dsi.DataType.ToStringI18N() }; var colourCell = new DataGridViewTextBoxCell { Value = dsi.Color }; Cells.AddRange(displayOnGraphCell, datasourceCell, typeCell, colourCell); }
private void InitPage() { this._cmbDataSource.SelectedIndex = -1; this._cmbDataSource.Items.Clear(); this._currentDataSource = null; this._cmbDataMember.SelectedIndex = -1; this._cmbDataMember.Items.Clear(); this._cmbLabelField.SelectedIndex = -1; this._cmbLabelField.Items.Clear(); this._xLists.Clear(); this._dataSourceDirty = false; }
private void dataGridViewDataSource_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (dataGridViewDataSource.Columns[e.ColumnIndex].Name == "ColumnDataMember") { object strdatasource = dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnDataSource"].Value; if (strdatasource == null) { strdatasource = string.Empty; } object strdatamember = dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnDataMember"].Value; if (strdatamember == null) { strdatamember = string.Empty; } if (tabledatasource[strdatasource] != null) { ArrayList objdatamember = (ArrayList)tabledatasource[strdatasource]; frmDataMember fdm = new frmDataMember(objdatamember, strdatamember.ToString()); if (fdm.ShowDialog() == DialogResult.OK) { if (fdm.lbDataMember.SelectedItem != null) { dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnDataMember"].Value = fdm.lbDataMember.SelectedItem; } else { dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnDataMember"].Value = string.Empty; } tabPageDataSource.Text = "DataSource Defination*"; btnSaveDataSource.Enabled = true; btnUndoDataSource.Enabled = true; } } e.Cancel = true; } else if (dataGridViewDataSource.Columns[e.ColumnIndex].Name == "ColumnImageColumns") { DataSourceImageColumnCollections dc = dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnImageColumns"].Tag as DataSourceImageColumnCollections; //create a new item DataSourceItem di = new DataSourceItem(); object objdatasource = dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnDataSource"].Value; object objdatamember = dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnDataMember"].Value; if (objdatasource == null || objdatasource.ToString().Trim().Length == 0 || objdatamember == null || objdatamember.ToString().Trim().Length == 0) { MessageBox.Show("Select datasource first!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { di.DataSource = DesignerHost.Container.Components[objdatasource.ToString()]; di.DataMember = objdatamember.ToString(); frmImageColumns fic = new frmImageColumns(dc, di); if (fic.ShowDialog() == DialogResult.OK) { dataGridViewDataSource.Rows[e.RowIndex].Cells["ColumnImageColumns"].Tag = fic.imagecollectionedit; tabPageDataSource.Text = "DataSource Defination*"; btnSaveDataSource.Enabled = true; btnUndoDataSource.Enabled = true; } } e.Cancel = true; } else { tabPageDataSource.Text = "DataSource Defination*"; btnSaveDataSource.Enabled = true; btnUndoDataSource.Enabled = true; } }