/// <summary> /// Move Right /// </summary> /// <param name="tlvi">Tile List View Item</param> internal void MoveRight(TileListViewItem tlvi) { int row; int column; getItemPosition(tlvi, out row, out column); if (column < itemsPerRow - 1) { column++; } if (!MoveToItem(row, column)) { if (NavigateItem == null || !NavigateItem(this, new NavigateItemEventArgs(0, column, MoveDirection.Right))) { row--; if (row >= 0) { MoveToItem(row, column); } } } }
/// <summary> /// Move to Item /// </summary> /// <param name="row">Row</param> /// <param name="column">Column</param> /// <returns>true on success</returns> public bool MoveToItem(int row, int column) { bool result = false; bool traversingListView = false; if (row == -1) { traversingListView = true; row = Items.Count / itemsPerRow; } if (column < itemsPerRow) { int index = row * itemsPerRow + column; if ((index >= Items.Count) && traversingListView) { if (--row >= 0) { index = row * itemsPerRow + column; } } if (index < Items.Count) { TileListViewItem tlvi = Items[index]; tlvi.Selected = true; tlvi.Focus(); result = true; } } return(result); }
/// <summary> /// Insert /// </summary> /// <param name="index">index of the item</param> /// <param name="value">TileListViewItem to be inserted</param> public void Insert(int index, TileListViewItem value) { value.Owner = this.owner; value.ItemSelected += new EventHandler(owner.item_Selected); value.DoubleClick += new EventHandler(owner.item_DoubleClick); owner.Controls.Add(value); owner.ReCalculateItems(); list.Insert(index, value); }
/// <summary> /// Add an iFolder to the listview. /// </summary> /// <param name="ifolderObject">The iFolder object to add to the listview.</param> /// <returns>A TileListViewItem object which represents the iFolder.</returns> public TileListViewItem AddiFolderToListView(iFolderObject ifolderObject) { TileListViewItem tlvi = null; tlvi = new TileListViewItem(ifolderObject); tlvi = tileListView1.Items.Add(tlvi); tileListView1.Items.Sort(); return(tlvi); }
public TileListViewItem Add(TileListViewItem value) { list.Add( value ); value.Owner = this.owner; value.ItemSelected += new EventHandler(owner.item_Selected); value.DoubleClick += new EventHandler(owner.item_DoubleClick); owner.Controls.Add( value ); owner.ReCalculateItems(); return value; }
/// <summary> /// Add /// </summary> /// <param name="value">TileListViewItem</param> /// <returns>TileListViewItem</returns> public TileListViewItem Add(TileListViewItem value) { list.Add(value); value.Owner = this.owner; value.ItemSelected += new EventHandler(owner.item_Selected); value.DoubleClick += new EventHandler(owner.item_DoubleClick); owner.Controls.Add(value); owner.ReCalculateItems(); return(value); }
/// <summary> /// Gets the position of the Item /// </summary> /// <param name="tlvi"></param> /// <param name="row">Row number</param> /// <param name="column">Column Number</param> private void getItemPosition(TileListViewItem tlvi, out int row, out int column) { int index = Items.IndexOf(tlvi); if (itemsPerRow == 0) { itemsPerRow = 1; } row = index / itemsPerRow; column = index - row * itemsPerRow; }
/// <summary> /// Move Down /// </summary> /// <param name="tlvi">Tile List View Item</param> internal void MoveDown(TileListViewItem tlvi) { int row; int column; getItemPosition(tlvi, out row, out column); if (!MoveToItem(++row, column) && NavigateItem != null) { NavigateItem(this, new NavigateItemEventArgs(0, column, MoveDirection.Down)); } }
private void TileListView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (selectedItem != null) { selectedItem.Selected = false; selectedItem = null; } if (SelectedIndexChanged != null) { SelectedIndexChanged(this, new EventArgs()); } }
/// <summary> /// Event Handler for tile list view click event /// </summary> private void TileListView_Click(object sender, System.EventArgs e) { if (selectedItem != null) { selectedItem.Selected = false; selectedItem = null; } if (SelectedIndexChanged != null) { SelectedIndexChanged(this, e); } }
/// <summary> /// Move Left /// </summary> /// <param name="tlvi">Tile List View Item</param> internal void MoveLeft(TileListViewItem tlvi) { int row; int column; getItemPosition(tlvi, out row, out column); if (column > 0) { column--; } MoveToItem(row, column); }
internal void item_Selected(object sender, EventArgs e) { TileListViewItem tlvi = (TileListViewItem)sender; if (selectedItem != null) { if (!tlvi.Equals(selectedItem)) { selectedItem.Selected = false; } } selectedItem = tlvi; if (SelectedIndexChanged != null) { SelectedIndexChanged(this, e); } }
/// <summary> /// Move Up /// </summary> /// <param name="tlvi">Tile List View Item</param> internal void MoveUp(TileListViewItem tlvi) { int row; int column; getItemPosition(tlvi, out row, out column); row--; if (row < 0) { if (NavigateItem != null) { NavigateItem(this, new NavigateItemEventArgs(row, column, MoveDirection.Up)); } } else { MoveToItem(row, column); } }
/// <summary> /// Contains /// </summary> /// <param name="value">TileListViewItem object</param> /// <returns>true if contains</returns> public bool Contains(TileListViewItem value) { return(list.Contains(value)); }
public int IndexOf(TileListViewItem value) { return list.IndexOf( value ); }
/// <summary> /// Index Of /// </summary> /// <param name="value">TileListViewItem object</param> /// <returns>index of the object</returns> public int IndexOf(TileListViewItem value) { return(list.IndexOf(value)); }
public void Remove(TileListViewItem value) { list.Remove( value ); owner.Controls.Remove( value ); owner.ReCalculateItems(); }
public void Insert(int index, TileListViewItem value) { value.Owner = this.owner; value.ItemSelected += new EventHandler(owner.item_Selected); value.DoubleClick += new EventHandler(owner.item_DoubleClick); owner.Controls.Add( value ); owner.ReCalculateItems(); list.Insert( index, value ); }
internal void MoveDown( TileListViewItem tlvi ) { int row; int column; getItemPosition( tlvi, out row, out column ); if ( !MoveToItem( ++row, column ) && NavigateItem != null ) { NavigateItem( this, new NavigateItemEventArgs( 0, column, MoveDirection.Down ) ); } }
public bool Contains(TileListViewItem value) { return list.Contains( value ); }
public void AddiFolderToAcceptediFolders(iFolderWeb ifolder, TileListViewItem selecteditem, String Path) { if (Path != null) DownloadPath = Path; if (selecteditem != null) removeTileListViewItem(selecteditem); if (ht.ContainsKey(ifolder.ID)) { removeTileListViewItem((TileListViewItem)ht[ifolder.ID]); } iFolderObject ifolderobj = new iFolderObject(ifolder, iFolderState.Initial); addiFolderToListView(ifolderobj); if (acceptedFolders.Contains(ifolderobj.iFolderWeb.ID)) acceptedFolders.Remove(ifolderobj.iFolderWeb.ID); ifolderobj.iFolderWeb.UnManagedPath = DownloadPath; TileListViewItem tlvi = new TileListViewItem(ifolderobj); acceptedFolders.Add(ifolderobj.iFolderWeb.ID, tlvi); ifolderobj = null; tlvi = null; }
public DomainInformation RemoveDomainFromUIList(string domainID, string defaultDomainID) { DomainInformation domainInfo = null; lock (iFolderListViews) { iFoldersListView ifListView = (iFoldersListView)iFolderListViews[domainID]; if (ifListView != null) { domainInfo = ifListView.DomainInfo; foreach (TileListViewItem tlvi in ifListView.Items) { if (tlvi.Selected) { selectedItem = null; updateMenus(null); } ht.Remove(((iFolderObject)tlvi.Tag).ID); } iFolderListViews.Remove(domainID); updateWidth(); panel2.Controls.Remove(ifListView); updateView(); } if (defaultDomainID != null) { ifListView = (iFoldersListView)iFolderListViews[defaultDomainID]; if (ifListView != null) { ifListView.DomainInfo.IsDefault = true; } } } return domainInfo; }
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (listView1.SelectedItems == null || listView1.SelectedItems.Count == 0) { if (selectedItem != null && selectedItem.Selected ) { selectedItem.Selected = false; selectedItem = null; } updateMenus(null); return; } string id = listView1.Items[listView1.SelectedIndices[0]].SubItems[4].Text.ToString(); TileListViewItem tlvi = (TileListViewItem)ht[id]; tlvi.Selected = true; }
private void removeTileListViewItem( TileListViewItem tlvi ) { if( tlvi == null) return; if ( tlvi.Equals( selectedItem ) ) { selectedItem = null; updateMenus( null ); } ht.Remove(((iFolderObject)tlvi.Tag).ID); tlvi.Remove(); if (tlvi.iFoldersListView.Items.Count == 0) { iFolderObject ifolderObj = (iFolderObject)tlvi.Tag; iFolderWeb ifolder = ifolderObj.iFolderWeb; refreshAll(); } if (!thumbnailView) { showiFolderinListView(); } updateView(); }
private void ifListView_SelectedIndexChanged(object sender, EventArgs e) { TileListView tileListView = ( TileListView )sender; if ( selectedItem != null && ( tileListView.SelectedItem == null || !tileListView.SelectedItem.Equals( selectedItem ) ) ) { selectedItem.Selected = false; } selectedItem = tileListView.SelectedItem; updateMenus( selectedItem == null ? null : (iFolderObject)selectedItem.Tag ); }
private void createChangeEvent(iFolderWeb ifolder, string eventData) { if (ifolder != null) { if (eventData.Equals("NodeCreated")) { { iFolderObject ifobject = new iFolderObject(ifolder, iFolderState.Normal); addiFolderToListView(ifobject); ifobject = null; if ( !ifolder.IsSubscription ) { Win32Window.ShChangeNotify(Win32Window.SHCNE_UPDATEITEM, Win32Window.SHCNF_PATHW, ifolder.UnManagedPath, IntPtr.Zero); } if (!ifolder.IsSubscription) { lock (ht) { TileListViewItem[] lvia = new TileListViewItem[ht.Count]; ht.Values.CopyTo(lvia, 0); foreach(TileListViewItem lvi in lvia) { iFolderObject ifo = lvi.Tag as iFolderObject; if (ifo.iFolderWeb.IsSubscription && (ifo.iFolderWeb.CollectionID == ifolder.CollectionID)) { ht.Remove(ifo.iFolderWeb.ID); lvi.Remove(); break; } } } } } } else { TileListViewItem tlvi; lock (ht) { tlvi = (TileListViewItem)ht[ifolder.ID]; } if (tlvi != null) { ((iFolderObject)tlvi.Tag).iFolderWeb = ifolder; updateListViewItem(tlvi); } } } }
public TileListViewItem AddiFolderToListView( iFolderObject ifolderObject ) { TileListViewItem tlvi = null; tlvi = new TileListViewItem( ifolderObject ); tlvi = tileListView1.Items.Add( tlvi ); tileListView1.Items.Sort(); return tlvi; }
/// <summary> /// Remove the TileListViewItem /// </summary> /// <param name="value">TileListViewItem which is being removed</param> public void Remove(TileListViewItem value) { list.Remove(value); owner.Controls.Remove(value); owner.ReCalculateItems(); }
private void updateListViewItem(TileListViewItem tlvi) { iFolderObject ifolderObject = (iFolderObject)tlvi.Tag; iFolderWeb ifolder = ifolderObject.iFolderWeb; if (ifolder.State.Equals("Available")) { lock (ht) { removeTileListViewItem( tlvi ); } } else { int imageIndex; tlvi.Status = getItemState( ifolderObject, objectsToSync, out imageIndex ); tlvi.ImageIndex = imageIndex; } }
internal void MoveLeft( TileListViewItem tlvi ) { int row; int column; getItemPosition( tlvi, out row, out column ); if ( column > 0 ) column--; MoveToItem( row, column ); }
internal void item_Selected(object sender, EventArgs e) { TileListViewItem tlvi = (TileListViewItem)sender; if (selectedItem != null) { if ( !tlvi.Equals(selectedItem) ) { selectedItem.Selected = false; } } selectedItem = tlvi; if ( SelectedIndexChanged != null ) { SelectedIndexChanged( this, e ); } }
private void addiFolderToListView(iFolderObject ifolderObject) { iFolderWeb ifolder = ifolderObject.iFolderWeb; if ( !ifolder.IsSubscription ) { lock (ht) { if (ht[ifolder.ID] == null) { TileListViewItem tlvi = new TileListViewItem( ifolderObject ); int imageIndex; tlvi.Status = getItemState( ifolderObject, 0, out imageIndex ); tlvi.ImageIndex = imageIndex; iFolderView.Items.Add(tlvi); iFolderView.Items.Sort(); ht.Add(ifolder.ID, tlvi); } } Win32Window.ShChangeNotify(Win32Window.SHCNE_UPDATEITEM, Win32Window.SHCNF_PATHW, ifolder.UnManagedPath, IntPtr.Zero); } else { lock( ht ) { if (ht[ifolder.ID] == null) { TileListViewItem tlvi = addiFolderToAvailableListView( ifolderObject ); ht.Add( ifolder.ID, tlvi ); } } } if (!thumbnailView) { showiFolderinListView(); } updateView(); }
internal void MoveRight( TileListViewItem tlvi ) { int row; int column; getItemPosition( tlvi, out row, out column ); if ( column < itemsPerRow - 1 ) column++; if ( !MoveToItem( row, column ) ) { if ( NavigateItem == null || !NavigateItem( this, new NavigateItemEventArgs( 0, column, MoveDirection.Right ) ) ) { row--; if ( row >= 0 ) { MoveToItem( row, column ); } } } }
private void DownloadOrMerge( bool mergeFolder) { bool added; bool result; if ( selectedItem != null ) { iFolderWeb ifolder = ((iFolderObject)selectedItem.Tag).iFolderWeb; iFolderObject ifobj = new iFolderObject(((iFolderObject)selectedItem.Tag).iFolderWeb, iFolderState.Disconnected); result = AcceptiFolder(ifolder, out added, mergeFolder); if ( result && added ) { ifobj.iFolderWeb.IsSubscription = false; lock (ht) { removeTileListViewItem( selectedItem ); iFolderObject ifolderobj = new iFolderObject(ifolder, iFolderState.Initial); addiFolderToListView(ifolderobj); if( acceptedFolders.Contains(ifobj.iFolderWeb.ID) ) acceptedFolders.Remove(ifobj.iFolderWeb.ID); ifobj.iFolderWeb.UnManagedPath = DownloadPath; TileListViewItem tlvi = new TileListViewItem(ifobj); acceptedFolders.Add(ifobj.iFolderWeb.ID, tlvi); ifolderobj = null; tlvi = null; } } else if( result && !added ) { syncLog.AddMessageToLog(DateTime.Now, string.Format("Download of iFolder \"{0}\" failed",ifobj.iFolderWeb.Name)); } } }
internal void MoveUp( TileListViewItem tlvi ) { int row; int column; getItemPosition( tlvi, out row, out column ); row--; if ( row < 0 ) { if ( NavigateItem != null ) { NavigateItem( this, new NavigateItemEventArgs( row, column, MoveDirection.Up ) ); } } else { MoveToItem( row, column ); } }
private void invokeiFolderProperties(TileListViewItem tlvi, int activeTab) { iFolderAdvanced ifolderAdvanced = new iFolderAdvanced(); ifolderAdvanced.CurrentiFolder = ((iFolderObject)tlvi.Tag).iFolderWeb; ifolderAdvanced.DomainName = ((DomainInformation)this.simiasWebService.GetDomainInformation(((iFolderObject)tlvi.Tag).iFolderWeb.DomainID)).Name; ifolderAdvanced.DomainUrl = ((DomainInformation)this.simiasWebService.GetDomainInformation(((iFolderObject)tlvi.Tag).iFolderWeb.DomainID)).HostUrl; ifolderAdvanced.LoadPath = Application.StartupPath; ifolderAdvanced.ActiveTab = activeTab; ifolderAdvanced.EventClient = eventClient; ifolderAdvanced.ShowDialog(); ifolderAdvanced.Dispose(); }
private void getItemPosition( TileListViewItem tlvi, out int row, out int column ) { int index = Items.IndexOf( tlvi ); if ( itemsPerRow == 0 ) itemsPerRow = 1; row = index / itemsPerRow; column = index - row * itemsPerRow; }
private void panel2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if ( selectedItem != null ) { selectedItem.Selected = false; selectedItem = null; this.menuActionOpen.Enabled = this.menuActionAccept.Enabled = this.menuActionMerge.Enabled = this.menuActionProperties.Enabled = this.menuActionRemove.Enabled = this.menuActionResolve.Enabled = this.menuActionRevert.Enabled = this.menuActionShare.Enabled = this.menuActionSync.Enabled = false; this.toolStripBtnDelete.Enabled = this.toolStripBtnDownload.Enabled = this.toolStripBtnMerge.Enabled = this.toolStripBtnResolve.Enabled = this.toolStripBtnRevert.Enabled = this.toolStripBtnShare.Enabled = this.toolStripBtnSyncNow.Enabled = false; } }
private void TileListView_Click(object sender, System.EventArgs e) { if ( selectedItem != null ) { selectedItem.Selected = false; selectedItem = null; } if ( SelectedIndexChanged != null ) { SelectedIndexChanged( this, e ); } }
private void updateListViewItem(TileListViewItem tlvi) { iFolderObject ifolderObject = (iFolderObject)tlvi.Tag; iFolderWeb ifolder = ifolderObject.iFolderWeb; if (ifolder.State.Equals("Available")) { lock (ht) { removeTileListViewItem( tlvi ); } } else { int imageIndex; tlvi.Status = getItemState( ifolderObject, objectsToSync, out imageIndex ); tlvi.ImageIndex = imageIndex; if (!thumbnailView) { ListViewItem item = listView1.FindItemWithText(ifolderObject.iFolderWeb.ID); listView1.Items[item.Index].ImageIndex = imageIndex; listView1.Items[item.Index].SubItems[3].Text = tlvi.Status; } } }
private void TileListView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if ( selectedItem != null ) { selectedItem.Selected = false; selectedItem = null; } if ( SelectedIndexChanged != null ) { SelectedIndexChanged( this, new EventArgs() ); } }
public void AddToAcceptedFolders(iFolderWeb ifWeb) { iFolderObject ifobj = new iFolderObject(ifWeb, iFolderState.Initial); addiFolderToListView(ifobj); TileListViewItem tlvi = new TileListViewItem(ifobj); acceptedFolders.Add(ifWeb.ID, tlvi); ifobj = null; tlvi = null; }
/// <summary> /// Constructs an ItemSelectedEventArgs object. /// </summary> /// <param name="lvi">The selected ListViewItem.</param> public ItemSelectedEventArgs(TileListViewItem tlvi) { this.tlvi = tlvi; }
public void UpdateDisplay( iFolderWeb ifolderWeb, string DownloadPath) { iFolderObject ifobj = new iFolderObject(ifolderWeb, iFolderState.Initial); addiFolderToListView(ifobj); if( acceptedFolders.Contains(ifolderWeb.ID) ) acceptedFolders.Remove(ifolderWeb.ID); ifolderWeb.UnManagedPath = DownloadPath; TileListViewItem tlvi = new TileListViewItem(ifobj); acceptedFolders.Add(ifolderWeb.ID, tlvi); ifobj = null; tlvi = null; }
private void panel2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if ( selectedItem != null ) { selectedItem.Selected = false; selectedItem = null; iFolderActions.Visible = false; this.menuActionOpen.Enabled = this.menuActionAccept.Enabled = this.menuActionMerge.Enabled = this.menuActionProperties.Enabled = this.menuActionRemove.Enabled = this.menuActionResolve.Enabled = this.menuActionRevert.Enabled = this.menuActionShare.Enabled = this.menuActionSync.Enabled = false; } }