Example #1
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            execMouseUp   = false;
            execMouseDown = false;

            if (execMouseLeave)
            {
                BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(mNewItem, mSuccessfullSave);
                this.OnBeforeNewSelection(args1);

                mSuccessfullSave = args1.SelectionChange;

                if (mSuccessfullSave)
                {
                    mNewItem.Selected = true;
                    mLastItem         = mNewItem;
                }

                rollbackItemSelected();

                this.EndUpdate();
            }
            execMouseLeave = false;
            execKeyDown    = true;
            execMouseDown  = true;
        }
Example #2
0
        private void selectNewItem()
        {
            clickTypeSelectorTimer.Stop();
            if (mNewItem.Equals(mLastItem) || (mLastItem == null && mNewItem.Equals(EMPTY_ITEM)))
            {
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            long start = DateTime.Now.Ticks;

            this.BeginUpdate();
            BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(mNewItem, mSuccessfullSave);

            this.OnBeforeNewSelection(args1);

            mSuccessfullSave = args1.SelectionChange;

            if (mSuccessfullSave)
            {
                mNewItem.Selected = true;
                mLastItem         = mNewItem;
            }

            rollbackItemSelected();

            this.EndUpdate();
            this.Cursor = Cursors.Default;
            Trace.WriteLine(string.Format("Select New Item ({0}) in: {1}", args1.ItemToBeSelected.Text, new TimeSpan(DateTime.Now.Ticks - start).ToString()));
        }
Example #3
0
 protected virtual void OnBeforeNewSelection(BeforeNewSelectionEventArgs e)
 {
     if (this.BeforeNewSelection != null)
     {
         BeforeNewSelection(this, e);
     }
 }
Example #4
0
 protected virtual void lstVwPaginated_BeforeNewSelection(object sender, BeforeNewSelectionEventArgs e)
 {
     if (BeforeNewListSelection != null)
     {
         BeforeNewListSelection(sender, e);
     }
 }
        private void OrderManagerSelectedIndexChangedEvent(object sender, BeforeNewSelectionEventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            
            var item = e.ItemToBeSelected;
            if (item != null && item.Tag != null)
                previewControl.ShowAnexo(item.Tag as Anexo);
            else
            {
                var items = ficheirosOrderManager1.getTrulySelectedItems();
                if (items.Count != 1) { previewControl.Clear(); this.Cursor = Cursors.Default; return; }

                previewControl.ShowAnexo(items[0].Tag as Anexo);
            }
            
            this.Cursor = Cursors.Default;
        }
Example #6
0
        public bool clearItemSelection(ListViewItem item)
        {
            if (item == null)
            {
                return(false);
            }
            this.BeginUpdate();
            BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(new ListViewItem(), true);

            this.OnBeforeNewSelection(args1);
            if (args1.SelectionChange)
            {
                item.Selected = false;
            }
            this.EndUpdate();
            return(args1.SelectionChange);
        }
Example #7
0
        public void selectItem(ListViewItem item)
        {
            if (item == null)
            {
                return;
            }
            long click = DateTime.Now.Ticks;

            this.BeginUpdate();
            BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(item, true);

            this.OnBeforeNewSelection(args1);
            if (args1.SelectionChange)
            {
                item.Selected = true;
                mLastItem     = item;
            }
            this.EndUpdate();
            Debug.WriteLine("<<ListSelect " + item.Text + ">> " + new TimeSpan(DateTime.Now.Ticks - click).ToString());
        }
        private void nivelGrupoArquivosList1_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
        {
            if (e.ItemToBeSelected.Tag != null)
                PermissoesHelper.UpdateNivelPermissions((GISADataset.NivelRow)e.ItemToBeSelected.Tag, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);

            try
            {
                Debug.WriteLine("nivelGrupoArquivosList1_BeforeNewListSelection");

                e.SelectionChange = UpdateContext(e.ItemToBeSelected);
                if (e.SelectionChange)
                {
                    updateContextStatusBar();
                    UpdateToolBarButtons(e.ItemToBeSelected);
                }
            }
            catch (GISA.Search.UpdateServerException)
            { }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw;
            }
        }
Example #9
0
        protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
        {
            if (!execKeyDown)
            {
                e.Handled = true;
                base.OnKeyDown(e);
            }
            else
            {
                base.OnKeyDown(e);
                execMouseDown  = false;
                execMouseLeave = false;
                execMouseUp    = false;
                doubleClick    = false;
                execKeyUp      = true;

                System.Windows.Forms.ListViewItem item = null;

                if (this.SelectedItems.Count == 1)
                {
                    if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Home || e.KeyCode == Keys.End)
                    {
                        item = new ListViewItem();
                        switch (e.KeyCode)
                        {
                        case Keys.Up:
                            if (this.Items.IndexOf(this.SelectedItems[0]) > 0)
                            {
                                item = this.Items[this.Items.IndexOf(this.SelectedItems[0]) - 1];
                            }
                            else
                            {
                                item = this.Items[0];
                            }
                            break;

                        case Keys.Down:
                            if (this.Items.IndexOf(this.SelectedItems[0]) < this.Items.Count - 1)
                            {
                                item = this.Items[this.Items.IndexOf(this.SelectedItems[0]) + 1];
                            }
                            else
                            {
                                item = this.Items[this.Items.Count - 1];
                            }
                            break;

                        case Keys.Home:
                            item = this.Items[0];
                            break;

                        case Keys.End:
                            item = this.Items[this.Items.Count - 1];
                            break;
                        }

                        BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(item, mSuccessfullSave);
                        this.OnBeforeNewSelection(args1);

                        mSuccessfullSave = args1.SelectionChange;

                        if (mSuccessfullSave)
                        {
                            item.Selected = true;
                            mLastItem     = item;
                        }
                    }
                    else if (e.KeyCode == Keys.Alt || e.KeyCode == Keys.ControlKey || e.KeyCode == Keys.ShiftKey)
                    {
                        execMouseDown = true; //permitir selecionar mais do que um elemento da lista usando ctrl/shift
                    }
                    else //if (!e.Alt && !e.Control && !e.Shift  && ((e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9) || (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9) || (e.KeyCode < Keys.Z || e.KeyCode > Keys.A)))
                    {
                        KeysConverter kc      = new KeysConverter();
                        string        keychar = kc.ConvertToString(e.KeyCode);

                        if (keychar.Contains("NumPad"))
                        {
                            keychar = keychar.Replace("NumPad", "");
                        }
                        if (keychar.Contains("OemMinus"))
                        {
                            keychar = keychar.Replace("OemMinus", "_");
                        }

                        int itemIndex = -1;
                        List <ListViewItem> matchItems = new List <ListViewItem>();
                        foreach (ListViewItem lvItem in this.Items)
                        {
                            if (lvItem.Text.ToLower().StartsWith(keychar.ToLower()))
                            {
                                matchItems.Add(lvItem);
                                if (this.SelectedItems.Count > 0 && this.SelectedItems[0] == lvItem)
                                {
                                    itemIndex = matchItems.Count - 1;
                                }
                            }
                        }

                        if (matchItems.Count == 1 && this.SelectedItems[0] != matchItems[0])
                        {
                            item = matchItems[0];
                        }
                        else if (matchItems.Count > 1)
                        {
                            if (itemIndex < 0)
                            {
                                item = matchItems[0];
                            }
                            else
                            {
                                if (itemIndex == matchItems.Count - 1)
                                {
                                    item = matchItems[0];
                                }
                                else
                                {
                                    item = matchItems[itemIndex + 1];
                                }
                            }
                        }

                        if (item != null)
                        {
                            BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(item, mSuccessfullSave);
                            this.OnBeforeNewSelection(args1);

                            mSuccessfullSave = args1.SelectionChange;

                            if (mSuccessfullSave)
                            {
                                item.Selected = true;
                                mLastItem     = item;
                            }
                            execMouseDown = true;
                        }
                    }
                }
                else if (e.Alt || e.Control || e.Shift)
                {
                    execMouseDown = true; //permitir selecionar mais do que um elemento da lista usando ctrl/shift
                }
                else
                {
                    mSuccessfullSave = false;
                }
            }
        }
Example #10
0
		public bool clearItemSelection(ListViewItem item) {
			if (item == null){
				return false;
			}
			this.BeginUpdate();
			BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(new ListViewItem(), true);
			this.OnBeforeNewSelection(args1);
			if (args1.SelectionChange)
				item.Selected = false;
			this.EndUpdate();
			return args1.SelectionChange;
		}
Example #11
0
		public void selectItem(ListViewItem item) {
			if (item == null){
				return;
			}
            long click = DateTime.Now.Ticks;
			this.BeginUpdate();
			BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(item, true);
			this.OnBeforeNewSelection(args1);
			if (args1.SelectionChange) {
				item.Selected = true;
				mLastItem = item;
			}
			this.EndUpdate();
            Debug.WriteLine("<<ListSelect " + item.Text +  ">> " + new TimeSpan(DateTime.Now.Ticks - click).ToString());
		}
Example #12
0
		protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
		{
            if (!execKeyDown)
            {
                e.Handled = true;
                base.OnKeyDown(e);
            }
            else
            {
                base.OnKeyDown(e);
                execMouseDown = false;
                execMouseLeave = false;
                execMouseUp = false;
                doubleClick = false;
                execKeyUp = true;

                System.Windows.Forms.ListViewItem item = null;

                if (this.SelectedItems.Count == 1)
                {
                    if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Home || e.KeyCode == Keys.End)
                    {
                        item = new ListViewItem();
                        switch (e.KeyCode)
                        {
                            case Keys.Up:
                                if (this.Items.IndexOf(this.SelectedItems[0]) > 0)
                                    item = this.Items[this.Items.IndexOf(this.SelectedItems[0]) - 1];
                                else
                                    item = this.Items[0];
                                break;
                            case Keys.Down:
                                if (this.Items.IndexOf(this.SelectedItems[0]) < this.Items.Count - 1)
                                    item = this.Items[this.Items.IndexOf(this.SelectedItems[0]) + 1];
                                else
                                    item = this.Items[this.Items.Count - 1];
                                break;
                            case Keys.Home:
                                item = this.Items[0];
                                break;
                            case Keys.End:
                                item = this.Items[this.Items.Count - 1];
                                break;
                        }

                        BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(item, mSuccessfullSave);
                        this.OnBeforeNewSelection(args1);

                        mSuccessfullSave = args1.SelectionChange;

                        if (mSuccessfullSave)
                        {
                            item.Selected = true;
                            mLastItem = item;
                        }
                    }
                    else if (e.KeyCode == Keys.Alt || e.KeyCode == Keys.ControlKey || e.KeyCode == Keys.ShiftKey)
                        execMouseDown = true; //permitir selecionar mais do que um elemento da lista usando ctrl/shift

                    else //if (!e.Alt && !e.Control && !e.Shift  && ((e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9) || (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9) || (e.KeyCode < Keys.Z || e.KeyCode > Keys.A)))
                    {
                        KeysConverter kc = new KeysConverter();
                        string keychar = kc.ConvertToString(e.KeyCode);

                        if (keychar.Contains("NumPad"))
                            keychar = keychar.Replace("NumPad", "");
                        if (keychar.Contains("OemMinus"))
                            keychar = keychar.Replace("OemMinus", "_");

                        int itemIndex = -1;
                        List<ListViewItem> matchItems = new List<ListViewItem>();
                        foreach (ListViewItem lvItem in this.Items)
                        {
                            if (lvItem.Text.ToLower().StartsWith(keychar.ToLower()))
                            {
                                matchItems.Add(lvItem);
                                if (this.SelectedItems.Count > 0 && this.SelectedItems[0] == lvItem)
                                    itemIndex = matchItems.Count - 1;
                            }
                        }

                        if (matchItems.Count == 1 && this.SelectedItems[0] != matchItems[0])
                            item = matchItems[0];
                        else if (matchItems.Count > 1)
                        {
                            if (itemIndex < 0)
                                item = matchItems[0];
                            else
                            {
                                if (itemIndex == matchItems.Count - 1)
                                    item = matchItems[0];
                                else
                                    item = matchItems[itemIndex + 1];
                            }
                        }

                        if (item != null)
                        {
                            BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(item, mSuccessfullSave);
                            this.OnBeforeNewSelection(args1);

                            mSuccessfullSave = args1.SelectionChange;

                            if (mSuccessfullSave)
                            {
                                item.Selected = true;
                                mLastItem = item;
                            }
                            execMouseDown = true;
                        }
                    }
                }
                else if (e.Alt || e.Control || e.Shift)
                    execMouseDown = true; //permitir selecionar mais do que um elemento da lista usando ctrl/shift
                else
                    mSuccessfullSave = false;
            }
		}
Example #13
0
		private void selectNewItem() 
		{
			clickTypeSelectorTimer.Stop();
            if (mNewItem.Equals(mLastItem) || (mLastItem == null && mNewItem.Equals(EMPTY_ITEM))) 
                return;
            this.Cursor = Cursors.WaitCursor;
            long start = DateTime.Now.Ticks;
			this.BeginUpdate();
			BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(mNewItem, mSuccessfullSave);
			this.OnBeforeNewSelection(args1);

			mSuccessfullSave = args1.SelectionChange; 

			if (mSuccessfullSave)
			{
				mNewItem.Selected = true;
				mLastItem = mNewItem;
			}

			rollbackItemSelected();	
	
			this.EndUpdate();
            this.Cursor = Cursors.Default;
            Trace.WriteLine(string.Format("Select New Item ({0}) in: {1}", args1.ItemToBeSelected.Text, new TimeSpan(DateTime.Now.Ticks - start).ToString()));
		}
Example #14
0
		protected override void OnMouseLeave(EventArgs e)
		{
			base.OnMouseLeave (e);
			execMouseUp = false;
			execMouseDown = false;

			if (execMouseLeave)
			{
				BeforeNewSelectionEventArgs args1 = new BeforeNewSelectionEventArgs(mNewItem, mSuccessfullSave);
				this.OnBeforeNewSelection(args1);

				mSuccessfullSave = args1.SelectionChange;

				if (mSuccessfullSave)
				{
					mNewItem.Selected = true;
					mLastItem = mNewItem;
				}

				rollbackItemSelected();

				this.EndUpdate();
			}
			execMouseLeave = false;
			execKeyDown = true;
			execMouseDown = true;
		}
Example #15
0
		protected virtual void OnBeforeNewSelection(BeforeNewSelectionEventArgs e)
		{
			if (this.BeforeNewSelection != null)
                BeforeNewSelection(this, e);
		}
		private void ufList_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
		{
			e.SelectionChange = UpdateContext(e.ItemToBeSelected);
			if (e.SelectionChange)
				UpdateToolBarButtons(e.ItemToBeSelected);
		}
Example #17
0
        protected override void NivelDocumentalListNavigator1_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
        {
            var topLevelControl = (frmMain)TopLevelControl;
            topLevelControl.EnterWaitMode();

            if (e.ItemToBeSelected != null)
            {
                var nRow = e.ItemToBeSelected.Tag as GISADataset.NivelRow;

                if (this.nivelNavigator1.EPFilterMode && this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural)
                    PermissoesHelper.UpdateNivelPermissions(nRow, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);
                else
                {
                    var nUpperRow = GisaDataSetHelper.GetInstance().Nivel.Cast<GISADataset.NivelRow>().FirstOrDefault(r => r.RowState != DataRowState.Deleted && r.ID == this.nivelNavigator1.ContextBreadCrumbsPathID);
                    if (nUpperRow != null)
                        PermissoesHelper.UpdateNivelPermissions(nRow, nUpperRow, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);
                }
            }

            if (topLevelControl != null && topLevelControl.MasterPanelCount == 1)
            {
                try
                {
                    Debug.WriteLine("NivelDocumentalListNavigator1_BeforeNewListSelection");
                    ListViewItem lvItem = null;
                    if (this.nivelNavigator1.SelectedItems.Count <= 1)
                        lvItem = e.ItemToBeSelected;

                    e.SelectionChange = UpdateContext(lvItem);
                    if (e.SelectionChange)
                    {
                        UpdateToolBarButtons(e.ItemToBeSelected);
                        updateContextStatusBar(e.ItemToBeSelected);

                        if (this.nivelNavigator1.SelectedItems.Count > 1)
                            // verificar se existe permissão de edição no conjunto de niveis selecionados
                            ToolBarButtonCut.Enabled = CheckEditPermission(this.nivelNavigator1.SelectedItems.Select(item => item.Tag as GISADataset.NivelRow).ToList());
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                    throw;
                }
            }

            ((frmMain)TopLevelControl).LeaveWaitMode();
        }
Example #18
0
 protected virtual void lstVwPaginated_BeforeNewSelection(object sender, BeforeNewSelectionEventArgs e)
 {
     if (BeforeNewListSelection != null) 
         BeforeNewListSelection(sender, e);
 }
        private void PermissoesNivelList1_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
        {
            ((frmMain)TopLevelControl).EnterWaitMode();

            GISADataset.NivelRow nivelRow = null;
            nivelRow = (GISADataset.NivelRow)e.ItemToBeSelected.Tag;
            //verificar se o nivel selecciona está apagado

            if (nivelRow == null)
            {
                ControloLocalizacao1.ClearTree();
            }
            else if (nRowSelected == nivelRow)
            {
                // não actualizar a árvore
            }
            else
            {
                //popular árvore
                GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
                try
                {
                    ControloLocalizacao1.BuildTree(nivelRow.ID, ho.Connection, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                    throw ex;
                }
                finally
                {
                    ho.Dispose();
                }
            }

            nRowSelected = nivelRow;
            ((frmMain)TopLevelControl).LeaveWaitMode();
        }
		private void caList_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
		{
			try
			{
				Debug.WriteLine("caList_BeforeNewListSelection");

				e.SelectionChange = UpdateContext(e.ItemToBeSelected);
				if (e.SelectionChange)
				{
					updateContextStatusBar();
					UpdateToolBarButtons(e.ItemToBeSelected);
				}
			}
            catch(GISA.Search.UpdateServerException)
            {}
			catch (Exception ex)
			{
				Trace.WriteLine(ex);
				throw;
			}
		}
Example #21
0
		private void lstVwTrustees_BeforeNewSelection(object sender, BeforeNewSelectionEventArgs e)
		{
			e.SelectionChange = UpdateContext(e.ItemToBeSelected);
            this.UpdateToolBarButtons(e.ItemToBeSelected);
		}
Example #22
0
		private void caList_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
		{
			if (e.ItemToBeSelected.ListView == null || (e.ItemToBeSelected != null && e.ItemToBeSelected.ListView == null))
			{
				relacaoCA.ContextNivelRow = null;
			}
			else
			{
				GISADataset.ControloAutRow caRow = null;
				caRow = ((GISADataset.ControloAutDicionarioRow)e.ItemToBeSelected.Tag).ControloAutRow;

				IDbConnection conn = GisaDataSetHelper.GetConnection();
				try
				{
					conn.Open();

					DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadNivelByControloAut(caRow.ID, GisaDataSetHelper.GetInstance(), conn);
				}
				catch (Exception ex)
				{
					Trace.WriteLine(ex);
					throw;
				}
				finally
				{
					conn.Close();
				}
				relacaoCA.ContextNivelRow = caRow.GetNivelControloAutRows()[0].NivelRow;
			}

			RefreshButtonState(e.ItemToBeSelected);
		}
Example #23
0
 private void aeList_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e) {
     try {
         Debug.WriteLine("aeList_BeforeNewListSelection");
         e.SelectionChange = UpdateContext(e.ItemToBeSelected);
         if (e.SelectionChange) {
             updateContextStatusBar();
         }
     }
     catch (Exception ex) {
         Trace.WriteLine(ex);
         throw;
     }
 }
		private void caList_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
		{
			UpdateButtonState(e.ItemToBeSelected);
		}