예제 #1
0
        /// <summary>
        /// Initializes a new <see cref="ExplorerBarItemOwnerUIAdapter"/>
        /// </summary>
        /// <param name="item">Item whose owning collection will be updated with any added elements.</param>
        public ExplorerBarItemOwnerUIAdapter(UltraExplorerBarItem item)
            : base(item.Group.Items)
        {
            Guard.ArgumentNotNull(item, "item");

            this.item = item;
        }
예제 #2
0
        private void userDataExplorerBar_MouseMove(object sender, MouseEventArgs e)
        {
            UltraExplorerBar explorerBar = sender as UltraExplorerBar;

            //  If the mouse has moved outside the area in which it was pressed,
            //  start a drag operation
            if (lastMouseDown.HasValue)
            {
                Size      dragSize = SystemInformation.DragSize;
                Rectangle dragRect = new Rectangle(lastMouseDown.Value, dragSize);
                dragRect.X -= dragSize.Width / 2;
                dragRect.Y -= dragSize.Height / 2;

                if (!dragRect.Contains(e.Location))
                {
                    if (explorerBar != null)
                    {
                        UltraExplorerBarItem itemAtPoint = explorerBar.ItemFromPoint(e.Location);

                        if (itemAtPoint != null)
                        {
                            lastMouseDown    = null;
                            dragExplorerItem = itemAtPoint;
                            explorerBar.DoDragDrop(dragExplorerItem, DragDropEffects.Move);
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Called to refresh the information displayed on this tab
        /// </summary>
        protected void RefreshTab()
        {
            this.assettypesExplorerBar.Groups[0].Items.Clear();
            _listAssetTypes = new AssetTypeList();
            _listAssetTypes.Populate();

            // We now need to display the Asset Type categories in the main ExplorerBar
            AssetTypeList categories = _listAssetTypes.EnumerateCategories();

            foreach (AssetType category in categories)
            {
                UltraExplorerBarItem item = this.assettypesExplorerBar.Groups[0].Items.Add(category.Name, category.Name);
                item.Settings.AppearancesLarge.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Medium);
                item.Tag = category;
            }

            // If nothing is selected in the Explorer View then select the first entry
            if (this.assettypesExplorerBar.ActiveItem == null)
            {
                if ((_activeItem == null) || (!this.assettypesExplorerBar.Groups[0].Items.Contains(_activeItem)))
                {
                    this.assettypesExplorerBar.ActiveItem = this.assettypesExplorerBar.Groups[0].Items[0];
                    _activeItem = this.assettypesExplorerBar.Groups[0].Items[0];
                }
                else
                {
                    this.assettypesExplorerBar.ActiveItem = _activeItem;
                }
            }
        }
예제 #4
0
        private void userDataExplorerBar_DragOver(object sender, DragEventArgs e)
        {
            UltraExplorerBar explorerBar = sender as UltraExplorerBar;
            Point            clientPos   = explorerBar.PointToClient(new Point(e.X, e.Y));

            if (dragExplorerItem != null)
            {
                dropExplorerItem = explorerBar.ItemFromPoint(clientPos);
                e.Effect         = dropExplorerItem != null && dropExplorerItem != dragExplorerItem ? DragDropEffects.Move : DragDropEffects.None;
            }

            //  If the cursor is within {dragScrollAreaHeight} pixels
            //  of the top or bottom edges of the control, scroll
            int dragScrollAreaHeight = 8;

            Rectangle displayRect   = explorerBar.DisplayRectangle;
            Rectangle topScrollArea = displayRect;

            topScrollArea.Height = (dragScrollAreaHeight * 2);

            Rectangle bottomScrollArea = displayRect;

            bottomScrollArea.Y      = bottomScrollArea.Bottom - dragScrollAreaHeight;
            bottomScrollArea.Height = dragScrollAreaHeight;

            ISelectionManager selectionManager = explorerBar;

            if (topScrollArea.Contains(clientPos) || bottomScrollArea.Contains(clientPos))
            {
                selectionManager.DoDragScrollVertical(0);
            }
        }
예제 #5
0
        private void DeleteCategory()
        {
            AssetType     activeAssetType   = _activeItem.Tag as AssetType;
            AssetTypeList listSubCategories = _listAssetTypes.EnumerateChildren(activeAssetType.AssetTypeID);

            if (listSubCategories.Count == 0)
            {
                if (MessageBox.Show("Are you sure that you want to delete this Asset Category?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
                {
                    return;
                }
            }
            else
            {
                if (MessageBox.Show("Are you sure that you want to delete this Asset Category?  Deleting the category will also delete all child asset types.", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
                {
                    return;
                }
            }

            // Delete this asset type and any sub-types
            if (activeAssetType.Delete() != 0)
            {
                MessageBox.Show("Failed to delete the selected Category - there may still be references to one of the child asset types which must be removed before the category may be deleted", "Delete Failed");
            }
            _activeItem = null;

            // We should still refresh as we have partially deleted the category
            RefreshTab();
        }
예제 #6
0
        private void assettypesExplorerBar_ActiveItemChanged(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
        {
            // Display the sub-items
            _activeItem = e.Item;
            AssetType selectedCategory = e.Item.Tag as AssetType;

            RefreshList(selectedCategory.AssetTypeID);

            bnEditCategory.Enabled = true;
        }
예제 #7
0
        private void userDataExplorerBar_ActiveItemChanged(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
        {
            // Display the sub-items
            _activeItem = e.Item;
            PickList selectedPickList = e.Item.Tag as PickList;

            RefreshList(selectedPickList);

            bnEditList.Enabled = true;
        }
예제 #8
0
        private void userDataExplorerBar_ActiveItemChanged(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
        {
            // Display the sub-items
            _activeItem = e.Item;
            if (e.Item != null)
            {
                UserDataCategory selectedCategory = e.Item.Tag as UserDataCategory;
                RefreshList(selectedCategory);
            }

            bnEditUserCategory.Enabled = true;
        }
예제 #9
0
 public void AddListItem(Image image, string title, UltraTab tab)
 {
     if (!settingsExplorerBar.Groups[0].Items.Exists(title))
     {
         UltraExplorerBarItem item = new UltraExplorerBarItem(title);
         item.Text = title;
         item.Key  = title;
         item.Tag  = tab;
         item.Settings.AppearancesLarge.Appearance.Image = image;
         this.settingsExplorerBar.Groups[0].Items.Add(item);
     }
 }
예제 #10
0
        public void Add(ExplorerBarTreeItem item)
        {
            object obj2 = null;

            if (this.m_Parent is UltraExplorerBar)
            {
                UltraExplorerBarGroup group = new UltraExplorerBarGroup {
                    Text = item.Text
                };
                ((UltraExplorerBar)this.m_Parent).Groups.Add(group);
                obj2 = group;
            }
            else if (this.m_Parent is UltraExplorerBarGroup)
            {
                UltraExplorerBarGroup parent = this.m_Parent as UltraExplorerBarGroup;
                if (item.IsTreeGroup)
                {
                    UltraExplorerBarContainerControl control = new UltraExplorerBarContainerControl();
                    parent.Container      = control;
                    parent.Settings.Style = GroupStyle.ControlContainer;
                    parent.ExplorerBar.Controls.Add(control);
                    UltraTree tree = new UltraTree {
                        Dock      = DockStyle.Fill,
                        ImageList = parent.ExplorerBar.ImageListSmall
                    };
                    control.Controls.Add(tree);
                    UltraTreeNode node = new UltraTreeNode {
                        Text = item.Text
                    };
                    tree.Nodes.Add(node);
                    obj2 = node;
                }
                else
                {
                    UltraExplorerBarItem item2 = new UltraExplorerBarItem {
                        Text = item.Text
                    };
                    parent.Items.Add(item2);
                    obj2 = item2;
                }
            }
            else if (this.m_Parent is UltraTree)
            {
                UltraTree     tree2 = this.m_Parent as UltraTree;
                UltraTreeNode node2 = new UltraTreeNode {
                    Text = item.Text
                };
                tree2.Nodes.Add(node2);
                obj2 = node2;
            }
            item.Control = obj2;
            this.m_List.Add(item);
        }
예제 #11
0
        /// <summary>
        /// Called to refresh the information displayed on the users tab
        /// </summary>
        protected void RefreshTab()
        {
            _listCategories.Scope = _currentScope;
            UserDataCategory dummy = new UserDataCategory(_currentScope);

            headerLabel.Text = "User Defined Data [" + dummy.ScopeAsString + "]";

            // Read the user defined data definitions from the database making sure that we set the
            // required scope first
            _listCategories.Populate();

            // Clear the list
            ulvUserData.Items.Clear();

            // Add the categories to the Explorer View
            userDataExplorerBar.BeginUpdate();
            userDataExplorerBar.Groups[0].Items.Clear();
            //
            foreach (UserDataCategory category in _listCategories)
            {
                UltraExplorerBarItem item = userDataExplorerBar.Groups[0].Items.Add(category.Name, category.Name);
                item.Settings.AppearancesLarge.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Medium);
                item.Tag = category;
            }

            // If nothing is selected in the Explorer View then select the first entry if there are any
            if (userDataExplorerBar.Groups[0].Items.Count != 0)
            {
                if (_activeItem == null)
                {
                    userDataExplorerBar.ActiveItem = userDataExplorerBar.Groups[0].Items[0];
                    _activeItem = userDataExplorerBar.Groups[0].Items[0];
                }

                else
                {
                    // Can we find the item
                    int index = userDataExplorerBar.Groups[0].Items.IndexOf(_activeItem.Key);
                    if (index != -1)
                    {
                        userDataExplorerBar.ActiveItem = userDataExplorerBar.Groups[0].Items[index];
                    }
                    else
                    {
                        userDataExplorerBar.ActiveItem = userDataExplorerBar.Groups[0].Items[0];
                        _activeItem = userDataExplorerBar.Groups[0].Items[0];
                    }
                }
            }

            userDataExplorerBar.EndUpdate();
        }
예제 #12
0
        private void LoadQuotetionCoins()
        {
            DataTable dt = mCnnBancoEcMgr.ExecutaSql(QueriesSQL.CONSULTA_COTACOES_ATIVAS);

            if (dt != null && dt.Rows.Count > 0)
            {
                String hojeAtt = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss");

                //Se não tiver internet, o sistema ignora
                if (mHasInternetConnection)
                {
                    for (int x = 0; x < dt.Rows.Count; x++)
                    {
                        //Apenas Salvo o nome da moeda para facilitar.
                        String coinName = dt.Rows[x]["MoedaPesquisa"].ToString();

                        //Adicionei essa variável, pois se a moeda já foi pesquisada, eu trago do banco o valor
                        //e a data/hora da atualização.
                        String cotacaoHoje = GetCoinCotation(coinName);
                        String dtAtt       = cotacaoHoje.Contains("|") ? cotacaoHoje.Split(new char[] { '|' })[1] : "";

                        //Contém a hora da consulta do valor da cotação.
                        UltraExplorerBarItem i2 = new UltraExplorerBarItem();
                        i2.Text = String.Format("Última atualização: '{0}'", !String.IsNullOrEmpty(dtAtt) ? dtAtt : hojeAtt);
                        i2.Settings.AppearancesSmall.Appearance.Image = Imagens_NewLookInterface.relogio_despertador_16;
                        lstGrupos.Items.Add(i2);

                        //Contém a opção para consultar todo o histórico.
                        UltraExplorerBarItem i3 = new UltraExplorerBarItem();
                        i3.Text = String.Format("Histórico da moeda '{0}'", coinName);
                        i3.Settings.AppearancesSmall.Appearance.Image = Edgecam_Manager.Properties.Resources.table;
                        i3.Settings.AppearancesSmall.Appearance.FontData.Underline = Infragistics.Win.DefaultableBoolean.True;
                        i3.Settings.AppearancesSmall.Appearance.ForeColor          = Color.Blue;
                        lstGrupos.Items.Add(i3);

                        //Contém a opção para consultar todo o histórico.
                        UltraExplorerBarItem i4 = new UltraExplorerBarItem();
                        i4.Text = String.Format("Atualizar o valor da cotação da moeda '{0}'", coinName);
                        i4.Settings.AppearancesSmall.Appearance.Image = Edgecam_Manager.Properties.Resources.refresh;
                        i4.Settings.AppearancesSmall.Appearance.FontData.Underline = Infragistics.Win.DefaultableBoolean.True;
                        i4.Settings.AppearancesSmall.Appearance.ForeColor          = Color.Blue;
                        lstGrupos.Items.Add(i4);

                        ueb.Groups.Add(lstGrupos);
                    }
                }
            }
        }
예제 #13
0
        private void InitUI()
        {
            #region ExplorerBar
            // activate the first group and then activate the first item in that group.
            UltraExplorerBarGroup group = this.ultraExplorerBar1.Groups["Sales"];
            if (group != null)
            {
                group.Active   = true;
                group.Selected = true;

                UltraExplorerBarItem item = group.Items["Customers"];
                if (item != null)
                {
                    item.Active = true;
                    this.ultraExplorerBar1.PerformAction(UltraExplorerBarAction.ClickActiveItem);
                }
            }
            #endregion // ExplorerBar

            #region AboutControl
            // setup the about control.
            Control control = new AboutControl();
            control.Visible = false;
            control.Parent  = this;
            ((Infragistics.Win.UltraWinToolbars.PopupControlContainerTool) this.ultraToolbarsManager1.Tools["pccAbout"]).Control = control;
            #endregion // AboutControl

            #region StatusBar

            #region ProgressBar
            // setup a timer to show progress during certain operations that could be time consuming.
            progressTimer          = Infragistics.Win.Utilities.CreateTimer();
            progressTimer.Interval = 250;
            progressTimer.Tick    += progressTimer_Tick;
            progressTimer.Start();
            #endregion // ProgressBar

            #region TrackBar
            // if there is a Midpoint defined set the value of the trackbar to the midpoint value.
            if (this.ultraTrackBar1.MidpointSettings.Value.HasValue)
            {
                this.ultraTrackBar1.Value = this.ultraTrackBar1.MidpointSettings.Value.Value;
            }
            #endregion // TrackBar

            #endregion // StatusBar
        }
예제 #14
0
 public FormAddPickItem(PickItem pickitem, UltraExplorerBarItem activeItem) : this()
 {
     m_activeItem = activeItem;
     _pickItem    = pickitem;
     if (pickitem.PickItemID == 0)
     {
         this.Text = "New PickItem";
         this.footerPictureBox.Image = Properties.Resources.pickitem_add_corner;
     }
     else
     {
         this.Text = "Pick Item Properties";
         this.footerPictureBox.Image = Properties.Resources.pickitem_add_corner;
     }
     //
     this.tbPickItemName.Text = _pickItem.Name;
 }
예제 #15
0
        private void OnDragEnd(UltraExplorerBar explorerBar, bool canceled)
        {
            if (canceled == false && dragExplorerItem != null && dropExplorerItem != null)
            {
                explorerBar.BeginUpdate();

                int index = dropExplorerItem.Index;
                explorerBar.Groups[0].Items.Remove(dragExplorerItem);
                explorerBar.Groups[0].Items.Insert(index, dragExplorerItem);

                explorerBar.EndUpdate();

                UpdateCategoriesTabOrder();
                RefreshTab();
            }

            dragExplorerItem = dropExplorerItem = null;
            lastMouseDown    = null;
        }
예제 #16
0
        /// <summary>
        /// Delete the currently selected user data category
        /// </summary>
        protected void DeleteUserDataCategory()
        {
            if (_activeItem == null)
            {
                return;
            }

            UserDataCategory userDataCategory = _activeItem.Tag as UserDataCategory;

            if (userDataCategory != null)
            {
                if (userDataCategory.Count == 0)
                {
                    if (MessageBox.Show("Are you sure that you want to delete this User Data Category?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
                    {
                        return;
                    }
                }
                else
                {
                    if (MessageBox.Show("Are you sure that you want to delete this User Data Category?  Deleting the category will also delete all User Data Fields defined within this category.", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                // Delete this user data category and any sub-types
                if (!userDataCategory.Delete())
                {
                    MessageBox.Show("Failed to delete the selected category.", "Delete Failed");
                }
                else
                {
                    UpdateCategoriesTabOrder();
                }
            }

            _activeItem = null;

            // We should still refresh as we have partially deleted the category
            RefreshTab();
        }
예제 #17
0
        private void DeletePickList()
        {
            if (_activeItem == null)
            {
                return;
            }

            PickList picklist = _activeItem.Tag as PickList;

            if (MessageBox.Show("Are you sure that you want to delete this Picklist?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
            {
                return;
            }

            // Delete this Picklist and any associated pick items
            picklist.Delete();
            _activeItem = null;

            // We should still refresh as we have partially deleted the category
            RefreshTab();
        }
예제 #18
0
        /// <summary>
        /// Called to refresh the information displayed on the users tab
        /// </summary>
        protected void RefreshTab()
        {
            // Save the name of the currently selected explorer bar item
            PickList lastSelectedPickList = null;

            if (_activeItem != null)
            {
                lastSelectedPickList = _activeItem.Tag as PickList;
            }

            // Read the user defined data definitions from the database
            _listPickLists.Populate();

            // Add the categories to the Explorer View
            this.pickListsExplorerBar.BeginUpdate();
            this.pickListsExplorerBar.Groups[0].Items.Clear();
            //
            foreach (PickList pickList in _listPickLists)
            {
                UltraExplorerBarItem item = this.pickListsExplorerBar.Groups[0].Items.Add(pickList.Name, pickList.Name);
                item.Settings.AppearancesLarge.Appearance.Image = Properties.Resources.picklist_32;
                item.Tag = pickList;

                // If this was the selected item previously then flag to select it again
                if ((lastSelectedPickList != null) &&
                    (lastSelectedPickList.Name == pickList.Name))
                {
                    this.pickListsExplorerBar.ActiveItem = item;
                }
            }

            // If nothing is selected in the Explorer View then select the first entry if there are any
            if (this.pickListsExplorerBar.Groups[0].Items.Count != 0)
            {
                this.pickListsExplorerBar.ActiveItem = this.pickListsExplorerBar.Groups[0].Items[0];
            }

            // Finish updating
            this.pickListsExplorerBar.EndUpdate();
        }
예제 #19
0
        private void CheckServiceRunning()
        {
            UltraExplorerBarItem item = this.overviewExplorerBar.Groups["auditwizardservice"].Items[0];

            if (item != null)
            {
                foreach (Process process in Process.GetProcesses())
                {
                    if (process.ProcessName == "AuditWizardService")
                    {
                        serviceRunning = true;
                        item.Settings.AppearancesSmall.Appearance.Image = global::Layton.AuditWizard.Overview.Properties.Resources.green_button;
                        item.Text = "Running";
                        return;
                    }
                }

                item.Text = "Not Running";
                item.Settings.AppearancesSmall.Appearance.Image = global::Layton.AuditWizard.Overview.Properties.Resources.red_button;
                serviceRunning = false;
            }
        }
예제 #20
0
 public void AddElements(WorkItem workItem, IEnumerable <UICommandDefinition> menuEntryEnumerable, Control host)
 {
     foreach (UICommandDefinition definition in menuEntryEnumerable)
     {
         if (definition.IsCategoryOrFolder)
         {
             if (!workItem.UIExtensionSites.Contains(definition.Site + "." + definition.Name))
             {
                 if (definition.Parent != null)
                 {
                     Microsoft.Practices.CompositeUI.Commands.Command command = (workItem is LocalCommandWorkItem) ? AddShortcutCommand((LocalCommandWorkItem)workItem, definition, host) : AddCommand(workItem, definition, host);
                     UltraTreeNode uiElement = this.CreateTreeNode(workItem, definition);
                     workItem.UIExtensionSites[definition.Site].Add <UltraTreeNode>(uiElement);
                     command.AddInvoker(uiElement, "Click");
                     workItem.UIExtensionSites.RegisterSite(definition.Site + "." + definition.Name, uiElement.Nodes);
                 }
                 else if (!definition.HasFolderChild)
                 {
                     UltraExplorerBarGroup group = new UltraExplorerBarGroup
                     {
                         Tag  = definition,
                         Text = definition.Text
                     };
                     workItem.UIExtensionSites[definition.Site].Add <UltraExplorerBarGroup>(group);
                     workItem.UIExtensionSites.RegisterSite(definition.Site + "." + definition.Name, group.Items);
                     ((workItem is LocalCommandWorkItem) ? AddShortcutCommand((LocalCommandWorkItem)workItem, definition, host) : AddCommand(workItem, definition, host)).AddInvoker(group, "GroupClick");
                 }
                 else
                 {
                     this.CreateGroupTree(workItem, definition);
                 }
             }
         }
         else
         {
             Microsoft.Practices.CompositeUI.Commands.Command command3 = (workItem is LocalCommandWorkItem) ? AddShortcutCommand((LocalCommandWorkItem)workItem, definition, host) : AddCommand(workItem, definition, host);
             if (!definition.Parent.HasFolderChild)
             {
                 UltraExplorerBarItem item = new UltraExplorerBarItem
                 {
                     Text = definition.Text,
                     Tag  = definition
                 };
                 workItem.UIExtensionSites[definition.Site].Add <UltraExplorerBarItem>(item);
                 item.Settings.AppearancesSmall.Appearance.Image = this.GetImage(definition);
                 command3.AddInvoker(item, "ItemClick");
             }
             else
             {
                 UltraTreeNode node2 = this.CreateTreeNode(workItem, definition);
                 workItem.UIExtensionSites[definition.Site].Add <UltraTreeNode>(node2);
                 command3.AddInvoker(node2, "Click");
             }
         }
     }
     foreach (UICommandDefinition definition2 in menuEntryEnumerable)
     {
         Microsoft.Practices.CompositeUI.Commands.Command command4 = workItem.Commands[definition2.Name];
         if (!string.IsNullOrEmpty(definition2.PermissionName))
         {
             if (workItem.Services.Get <IAuthorizationService>().Authorize(Thread.CurrentPrincipal, definition2.PermissionName))
             {
                 command4.Status = CommandStatus.Enabled;
             }
             else
             {
                 command4.Status = CommandStatus.Unavailable;
             }
         }
         else
         {
             command4.Status = CommandStatus.Enabled;
         }
     }
 }
예제 #21
0
        private void ultraExplorerBar1_ItemClick(object sender, ItemEventArgs e)
        {
            UltraExplorerBarItem anItem = e.Item;
            mGroupItemTag        tag    = (mGroupItemTag)anItem.Tag;
            string sql = "";

            try
            {
                // First need to make sure the user can change this Task
                // First, check whether the image or the text was clicked
                if (VWA4Common.AppContext.TaskItemImageClicked)
                {
                    /// IMAGE was clicked - change the image
                    // First need to make sure the user can change it
                    if (VWA4Common.GlobalSettings.IsSuper ||
                        VWA4Common.GlobalSettings.IsLogged)
                    {
                        /// allow the current user to check or uncheck this task

                        anItem.Settings.AppearancesSmall.Appearance.Image =
                            ((int)anItem.Settings.AppearancesSmall.Appearance.Image == 0) ? 1 : 0;
                        if ((int)anItem.Settings.AppearancesSmall.Appearance.Image == 0)
                        {
                            // Change Item to Not Enabled
                            anItem.Checked = false;
                            sql            = "UPDATE TaskItems SET Enabled = false WHERE UniqueName = '" + anItem.Key + "';";
                        }
                        else
                        {
                            // Change Item to Enabled
                            anItem.Checked = true;
                            sql            = "UPDATE TaskItems SET Enabled = true WHERE UniqueName = '" + anItem.Key + "';";
                        }
                        // Update Database
                        VWA4Common.DB.Update(sql);
                        commonEvents.UpdateProductUI = true;
                        /// Update the Taskbar
                        // UCTaskList is listening to week start event, so cause it to fire & reload
                        trackerDetector.FireWeekStart();
                    }
                    else
                    {
                        /// disallow the current user from checking or unchecking this task
                    }
                }
                else
                {
                    /// Text was clicked, so change the name
                    // First need to make sure the user can change it
                    if (VWA4Common.GlobalSettings.IsSuper ||
                        VWA4Common.GlobalSettings.IsLogged)
                    {
                        if (!anItem.Checked)
                        {
                            if (MessageBox.Show("This Task is currently disabled - Remove this Task permanently from the Task Bar?",
                                                "Disabled Task Removal", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                // Delete the Task
                                sql = "DELETE FROM TaskItems WHERE ID=" + tag.ID + ";";
                                VWA4Common.DB.Delete(sql);

                                /// Update the real Taskbar
                                // UCTaskList is listening to week start event, so cause it to fire & reload
                                trackerDetector.FireWeekStart();
                                return;
                            }
                        }
                        // If we get here, user just wants to rename the Group
                        /// allow the current user to rename this task
                        VWA4Common.DialogGet1LineofText dtb = new VWA4Common.DialogGet1LineofText(
                            "Please type in the new Task Name below:",
                            e.Item.Text, "Change Task Name");
                        if (dtb.ShowDialog() == DialogResult.OK)
                        {
                            e.Item.Text = dtb.sNewText;
                            dtb.Dispose();
                            // Update database with new name
                            sql = "UPDATE TaskItems SET DisplayName = '"
                                  + e.Item.Text + "' WHERE UniqueName = '" + anItem.Key + "';";
                            VWA4Common.DB.Update(sql);

                            /// Update the Taskbar
                            // UCTaskList is listening to week start event, so cause it to fire & reload
                            trackerDetector.FireWeekStart();
                        }
                    }
                    else
                    {
                        /// disallow the current user from checking or unchecking this task
                    }
                }
            }
            finally
            {
                LoadTaskBarData();
            }
        }
예제 #22
0
        ///
        /// Task Bar Setup
        ///

        private void LoadTaskBarData()
        {
            ultraExplorerBar1.Groups.Clear();
            // Assume the DB table is properly initialized
            //
            // Add Groups and Items (for those Groups that we find)
            //
            DataTable dtGroups = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = 0 ORDER BY Rank");

            foreach (DataRow row in dtGroups.Rows)
            {
                // Add the next group
                UltraExplorerBarGroup aGroup = new UltraExplorerBarGroup();
                aGroup      = ultraExplorerBar1.Groups.Add();
                aGroup.Text = row["DisplayName"].ToString();
                string sssss      = row["UniqueName"].ToString();
                bool   grpenabled = bool.Parse(row["Enabled"].ToString());
                //aGroup.Expanded = bool.Parse(row["Expanded"].ToString());
                aGroup.Key = sssss;
                aGroup.Settings.AllowDrag = Infragistics.Win.DefaultableBoolean.True;
                int gpid = (int)row["ID"];

                aGroup.Tag = new mGroupItemTag(gpid, sssss, int.Parse(row["ParentID"].ToString()),
                                               int.Parse(row["Rank"].ToString()), bool.Parse(row["Expanded"].ToString()), grpenabled);

                // Add Items under this Group
                DataTable dtItems = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = "
                                                           + gpid.ToString() + " ORDER BY Rank");
                foreach (DataRow irow in dtItems.Rows)
                {
                    UltraExplorerBarItem anItem = new UltraExplorerBarItem();
                    anItem.Checked = bool.Parse(irow["Enabled"].ToString());
                    if ((!anItem.Checked && ((int.Parse(VWA4Common.GlobalSettings.HideDisabledTasks) == 2) &&
                                             !VWA4Common.GlobalSettings.IsSuper)) ||
                        !anItem.Checked && ((int.Parse(VWA4Common.GlobalSettings.HideDisabledTasks) == 1) &&
                                            (!VWA4Common.GlobalSettings.IsLogged && !VWA4Common.GlobalSettings.IsSuper))
                        )
                    {
                        /// NOT going to show this task to the current user
                        // So just don't add it
                    }
                    else
                    {
                        /// AM going to show this task to the current user
                        anItem.Text = irow["DisplayName"].ToString();
                        anItem.Key  = irow["UniqueName"].ToString();
                        anItem.Settings.AllowDragMove = ItemDragStyle.WithinAndAcrossGroups;
                        if (anItem.Checked)
                        {
                            anItem.Settings.AppearancesSmall.Appearance.Image = 1;
                        }
                        else
                        {
                            anItem.Settings.AppearancesSmall.Appearance.Image = 0;
                        }
                        anItem.Tag = new mGroupItemTag(int.Parse(irow["ID"].ToString()), anItem.Key, int.Parse(irow["ParentID"].ToString()),
                                                       int.Parse(irow["Rank"].ToString()), bool.Parse(irow["Expanded"].ToString()), anItem.Checked);
                        // Add the Item to its group
                        aGroup.Items.Add(anItem);
                    }
                }
                if (grpenabled)
                {
                    aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.False;
                    aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Bold      = Infragistics.Win.DefaultableBoolean.True;
                }

                else
                {
                    aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.True;
                    aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Bold      = Infragistics.Win.DefaultableBoolean.False;
                }
            }
            ultraExplorerBar1.Groups.ExpandAll();
            ultraExplorerBar1.ActiveItem = null;
            this.ultraExplorerBar1.Update();
        }
예제 #23
0
        public static void LoadItems(DataView dv, UltraExplorerBar explorerBar, UltraExplorerBarGroup explorerBarGroup)
        {
            foreach (DataRowView drv in dv)
            {
                long   IdHerramienta = ( long )drv["IdHerramienta"];
                string id            = ( string )drv["id"];
                System.Console.WriteLine(IdHerramienta);
                System.Console.WriteLine(id);

                if (HasChilds(dv.Table, IdHerramienta))
                {
                    UltraExplorerBarGroup newExplorerBarGroup = new UltraExplorerBarGroup(GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta));
                    newExplorerBarGroup.Text = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);

                    explorerBar.Groups.Add(newExplorerBarGroup);

                    LoadItems(new DataView(dv.Table, string.Format("IdHerramientaPadre = {0}", drv["IdHerramienta"]), null, DataViewRowState.OriginalRows), explorerBar, newExplorerBarGroup);
                }
                else
                {
                    UltraExplorerBarItem newExplorerBarItem = new UltraExplorerBarItem(id);
                    newExplorerBarItem.Text = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);

                    if (GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta) != string.Empty)
                    {
                        //German 20110329 - Tarea 0000093
                        ImageList ilSmall = explorerBar.ImageListSmall;
                        string    prueba  =
                            string.Format(
                                mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "16");
                        Image image1 = null;
                        try
                        {
                            System.Drawing.Icon c = new Icon(prueba);
                            image1 = c.ToBitmap();
                        }
                        catch (Exception e)
                        {
                            image1 = Image.FromFile(prueba);
                            //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                        }
                        int smallIndexImage = ilSmall.Images.Add(image1, System.Drawing.Color.Magenta);

                        ImageList ilLarge = explorerBar.ImageListLarge;
                        prueba =
                            string.Format(
                                mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "24");
                        //int largeIndexImage = ilLarge.Images.Add(Image.FromFile(prueba), System.Drawing.Color.Magenta);
                        try
                        {
                            System.Drawing.Icon c = new Icon(prueba);
                            image1 = c.ToBitmap();
                        }
                        catch (Exception e)
                        {
                            image1 = Image.FromFile(prueba);
                            //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                        }
                        int largeIndexImage = ilLarge.Images.Add(image1, System.Drawing.Color.Magenta);
                        //Fin German 20110329 - Tarea 0000093


                        newExplorerBarItem.Settings.AppearancesSmall.Appearance.Image = smallIndexImage;
                        newExplorerBarItem.Settings.AppearancesLarge.Appearance.Image = largeIndexImage;
                    }

                    try
                    {
                        explorerBarGroup.Items.Add(newExplorerBarItem);
                    }
                    catch {}
                }
            }
        }
예제 #24
0
        /// <summary>
        /// Load up the Explorer Bar from the DB.
        /// </summary>
        public void LoadData()
        {
            string ssd = DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek).Date.ToString("yyyyMMdd");
            // Get all checkmark data for this week and this site
            DataTable dtItemChecks = VWA4Common.DB.Retrieve("SELECT * FROM TaskStates WHERE (Format(WeekStartDate, 'yyyymmdd') = "
                                                            + ssd + ") AND (SiteID=" + VWA4Common.GlobalSettings.CurrentSiteID.ToString() + ");"
                                                            );

            ultraExplorerBar1.Groups.Clear();
            // Assume the DB table is properly initialized
            //
            // Add Groups and Items (for those Groups that we find)
            //
            DataTable dtGroups = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = 0 ORDER BY Rank");

            foreach (DataRow row in dtGroups.Rows)
            {
                if (bool.Parse(row["Enabled"].ToString()))
                {
                    // Add the next group
                    UltraExplorerBarGroup aGroup = new UltraExplorerBarGroup();
                    aGroup      = ultraExplorerBar1.Groups.Add();
                    aGroup.Text = row["DisplayName"].ToString();
                    string sssss = row["UniqueName"].ToString();
                    aGroup.Expanded = bool.Parse(row["Expanded"].ToString());
                    aGroup.Key      = sssss;
                    int gpid = (int)row["ID"];
                    // Add Items under this Group
                    DataTable dtItems = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = "
                                                               + gpid.ToString() + " ORDER BY Rank");
                    foreach (DataRow irow in dtItems.Rows)
                    {
                        if (bool.Parse(irow["Enabled"].ToString()))
                        {                 // This item is enabled - add it
                            UltraExplorerBarItem anItem = new UltraExplorerBarItem();
                            anItem.Text    = irow["DisplayName"].ToString();
                            anItem.Key     = irow["UniqueName"].ToString();
                            anItem.Checked = false;                     // initialize
                            // Check DB to see if this item is checked
                            foreach (DataRow icrow in dtItemChecks.Rows)
                            {
                                // Do we have an entry that matches the current item?
                                //int icrowtest = (int)icrow["TaskID"];
                                //int irowtest = (int)irow["ID"];
                                if (icrow["TaskUniqueName"].ToString() == irow["UniqueName"].ToString())
                                {
                                    // There is a task item check entry for this item
                                    anItem.Checked = (bool)icrow["TaskChecked"];
                                }
                            }
                            if (anItem.Checked)
                            {
                                anItem.Settings.AppearancesSmall.Appearance.Image = 1;
                            }
                            else
                            {
                                anItem.Settings.AppearancesSmall.Appearance.Image = 0;
                            }
                            // Is this item the current task?

                            aGroup.Items.Add(anItem);
                        }
                        else
                        {                 // This item is not enabled - don't add it
                        }
                    }
                }
            }
            this.ultraExplorerBar1.Update();
        }
예제 #25
0
 /// <summary>
 /// Returns the index at which an item will be added.
 /// </summary>
 /// <param name="item">Item to evaluate</param>
 /// <returns>By default, items are added at the end of the associated <see cref="Items"/> collection.</returns>
 protected override int GetNewElementIndex(UltraExplorerBarItem item)
 {
     return(this.Items.IndexOf(this.item) + 1);
 }
예제 #26
0
 public ExplorerItemInvokerKey(UltraExplorerBarItem item)
 {
     this.item = item;
 }