Exemplo n.º 1
0
    public void CreateResourceListView()
    {
        ResourceListView newObj = Instantiate <ResourceListView>(resourceListViewPrefab);
        Window           window = winSystem.NewWindow("ResourceList", newObj.gameObject);

        window.Title = "resources list";
    }
Exemplo n.º 2
0
        /// <summary>
        /// If you wanna get rid of some view (table OR tree) this is the method. You cannot disable all views - will receive exception.
        /// </summary>
        /// <param name="view"></param>
        public void DisableView(ResourceListView view)
        {
            if (view == ResourceListView.None)
            {
                throw new ArgumentException("Cannot disable `None` view");
            }

            if (view == ResourceListView.Table)
            {
                if (IsTreeViewDisabled)
                {
                    throw new ArgumentException("Cannot disable both views");
                }

                IsTableViewDisabled = true;
            }


            if (view == ResourceListView.Tree)
            {
                if (IsTableViewDisabled)
                {
                    throw new ArgumentException("Cannot disable both views");
                }

                IsTreeViewDisabled = true;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update data source of ZentityGridView base of current page index.
        /// </summary>
        private void Refresh()
        {
            RefreshResourceData();

            //Enable feed for this control
            CreateSearchCriteria();
            ResourceListView.EnableFeed(SearchCriteria);
        }
Exemplo n.º 4
0
        private void SearchCmdExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var r = new ResourceListView();

            r.InputBindings.Add(
                new KeyBinding(App.WorldViewModel.FollowSelected, Key.G, ModifierKeys.Control));
            r.InputBindings.Add(
                new KeyBinding(App.WorldViewModel.CreateEntity, Key.C, ModifierKeys.Control));
            BindAndShow(r, App.WorldViewModel);
        }
        private void NextNavCommandHandler()
        {
            ResourceListView.MoveCurrentToNext();

            if (ResourceListView.IsCurrentAfterLast == true)
            {
                ResourceListView.MoveCurrentToLast();
            }

            SelectedResource = (ResourceModel)ResourceListView.CurrentItem;
        }
        private void PreviousNavCommandHandler()
        {
            ResourceListView.MoveCurrentToPrevious();

            if (ResourceListView.IsCurrentBeforeFirst == true)
            {
                ResourceListView.MoveCurrentToFirst();
            }

            SelectedResource = (ResourceModel)ResourceListView.CurrentItem;
        }
Exemplo n.º 7
0
        private void RefreshResourceData()
        {
            IList <Resource> entityList = null;
            Dictionary <Guid, IEnumerable <string> > userPermissions = null;
            int totalRecords = 0;

            int pageSize       = _pageSizeRage[PageSizeList.SelectedIndex > 0 ? PageSizeList.SelectedIndex : 0];
            int fetchedRecords = pageSize * ResourceListView.PageIndex;

            // Fetch entities from database.
            if (!IsSecurityAwareControl)
            {
                entityList = GetEntityList(fetchedRecords, pageSize, out totalRecords);
            }
            else
            {
                entityList = GetEntityList(AuthenticatedToken, fetchedRecords, pageSize, out totalRecords,
                                           this.SortExpression, this.SortDirection);
                if (entityList != null && entityList.Count > 0)
                {
                    userPermissions = GetPermissions(AuthenticatedToken, entityList);
                }
            }

            ResourceListView.PageSize     = pageSize;
            ResourceListView.TotalRecords = totalRecords;

            ResourceListView.DataSource.Clear();
            foreach (Resource resource in entityList)
            {
                ResourceListView.DataSource.Add(resource);
            }

            ResourceListView.UserPermissions = userPermissions;
            ResourceListView.DataBind();
        }
Exemplo n.º 8
0
    private void RefreshDataSource(int pageIndex, string searchText)
    {
        int totalPages = 0;

        ResourceListView.PageIndex    = 0;
        ResourceListView.TotalRecords = 0;
        ResourceListView.DataSource.Clear();
        if (!string.IsNullOrEmpty(searchText))
        {
            int totalRecords = 0;
            ResourceListView.PageSize = _pageSize;
            int             totalParsedRecords = totalParsedRecords = _pageSize * pageIndex;
            List <Resource> foundRestResource  = null;
            Dictionary <Guid, IEnumerable <string> > userPermissions = null;

            SortProperty sortProp = null;
            if (ResourceListView.SortDirection == System.Web.UI.WebControls.SortDirection.Ascending)
            {
                sortProp = new SortProperty(ResourceListView.SortExpression, Zentity.Platform.SortDirection.Ascending);
            }
            else
            {
                sortProp = new SortProperty(ResourceListView.SortExpression, Zentity.Platform.SortDirection.Descending);
            }

            //search resources and user permissions on the searched resources.
            using (ResourceDataAccess dataAccess = new ResourceDataAccess())
            {
                AuthenticatedToken token = this.Session[Constants.AuthenticationTokenKey] as AuthenticatedToken;
                if (token != null)
                {
                    foundRestResource = dataAccess.SearchResources(token, searchText, _pageSize, sortProp, totalParsedRecords,
                                                                   false, out totalRecords).ToList();
                    userPermissions = GetPermissions(token, foundRestResource);
                }
            }

            //Calculate total pages
            if (totalRecords > 0)
            {
                totalPages = Convert.ToInt32(Math.Ceiling((double)totalRecords / _pageSize));
            }

            // Update empty resource's title with default value.
            if (foundRestResource != null && foundRestResource.Count() > 0)
            {
                Utility.UpdateResourcesEmptyTitle(foundRestResource);
            }

            //Bind data to GridView
            ResourceListView.TotalRecords = totalRecords;
            ResourceListView.PageIndex    = pageIndex;

            foreach (Resource resource in foundRestResource)
            {
                ResourceListView.DataSource.Add(resource);
            }

            ResourceListView.UserPermissions = userPermissions;
            //Enable feed for this page.
            string searchString = GetSearchString();
            if (!string.IsNullOrEmpty(searchString))
            {
                ResourceListView.EnableFeed(searchString);
            }
            ResourceListView.DataBind();
        }
    }
Exemplo n.º 9
0
        public MainForm()
        {
            InitializeComponent();

            // This is set in BaseForm, so override it so the main form opens in the right location rather than in the middle of <desktop>
            this.StartPosition = FormStartPosition.WindowsDefaultLocation;

            MainFormInit();

            this.AllowDrop = true;

            this.Load        += new EventHandler(MainForm_Load);
            this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing);
            this.DragEnter   += new DragEventHandler(MainForm_DragEnter);
            this.DragLeave   += new EventHandler(MainForm_DragLeave);

            this.__dropTarget.DragEnter       += new DragEventHandler(__dropTarget_DragEnter);
            this.__dropTarget.DragLeave2      += new EventHandler(__dropTarget_DragLeave);
            this.__dropTarget.DropDataAdd     += new EventHandler(__dropTarget_DropDataAdd);
            this.__dropTarget.DropDataReplace += new EventHandler(__dropTarget_DropDataReplace);
            this.__dropTarget.DropSourceLoad  += new EventHandler(__dropTarget_DropSourceLoad);

            ToolStripManager.Renderer = new Anolis.Resourcer.Controls.ToolStripImprovedSystemRenderer();

            #region Toolstrip Events

            this.__tSrcNew.Click            += new EventHandler(__tSrcNew_Click);
            this.__tSrcOpen.ButtonClick     += new EventHandler(__tSrcOpen_ButtonClick);
            this.__tSrcOpen.DropDownOpening += new EventHandler(__tSrcOpen_DropDownOpening);
            this.__tSrcBatch.Click          += new EventHandler(__tSrcBatch_Click);
            this.__tSrcMruClear.Click       += new EventHandler(__tSrcMruClear_Click);
            this.__tSrcSave.ButtonClick     += new EventHandler(__tSrcSave_Click);
            this.__tSrcSaveBackup.Click     += new EventHandler(__tSrcSaveBackup_Click);
            this.__tSrcSavePending.Click    += new EventHandler(__tSrcSavePending_Click);
            this.__tSrcReve.Click           += new EventHandler(__tSrcReve_Click);
            this.__tResAdd.Click            += new EventHandler(__tResAdd_Click);
            this.__tResExt.Click            += new EventHandler(__tResExt_Click);
            this.__tResRep.Click            += new EventHandler(__tResRep_Click);
            this.__tResDel.Click            += new EventHandler(__tResDel_Click);
            this.__tResCan.Click            += new EventHandler(__tResCan_Click);
            this.__tGenOpt.Click            += new EventHandler(__tGenOptions_Click);

            #endregion

            this.__tree.NodeMouseClick += new TreeNodeMouseClickEventHandler(__tree_NodeMouseClick);
            this.__tree.BeforeCollapse += new TreeViewCancelEventHandler(__tree_BeforeCollapse);
            this.__tree.AfterSelect    += new TreeViewEventHandler(__tree_AfterSelect);
            this.__treeMenu.Opening    += new System.ComponentModel.CancelEventHandler(__treeMenu_Opening);

            this.KeyDown   += new KeyEventHandler(MainForm_KeyDown);
            this.KeyUp     += new KeyEventHandler(MainForm_KeyUp);
            this.KeyPreview = true;

            #region Menu Events

            this.__mFileNew.Click        += new EventHandler(__mFileNew_Click);
            this.__mFileOpen.Click       += new EventHandler(__mFileOpen_Click);
            this.__mFileSave.Click       += new EventHandler(__mFileSave_Click);
            this.__mFileClose.Click      += new EventHandler(__mFileClose_Click);
            this.__mFileBackup.Click     += new EventHandler(__mFileBackup_Click);
            this.__mFileRevert.Click     += new EventHandler(__mFileRevert_Click);
            this.__mFileProperties.Click += new EventHandler(__mFileProperties_Click);
            this.__mFileExit.Click       += new EventHandler(__mFileExit_Click);

            this.__mEditCut.Click       += new EventHandler(__mEditCut_Click);
            this.__mEditCopy.Click      += new EventHandler(__mEditCopy_Click);
            this.__mEditPaste.Click     += new EventHandler(__mEditPaste_Click);
            this.__mEditFind.Click      += new EventHandler(__mEditFind_Click);
            this.__mEditFindNext.Click  += new EventHandler(__mEditFindNext_Click);
            this.__mEditSelectAll.Click += new EventHandler(__mEditSelectAll_Click);

            this.__mViewToolbar.Click      += new EventHandler(__mViewToolbar_Click);
            this.__mViewToolbarLarge.Click += new EventHandler(__mViewToolbarLarge_Click);
            this.__mViewToolbarSmall.Click += new EventHandler(__mViewToolbarSmall_Click);
            this.__mViewMenus.Click        += new EventHandler(__mViewMenus_Click);
            this.__mViewEffects.Click      += new EventHandler(__mViewEffects_Click);

            this.__mActionImport.Click  += new EventHandler(__mActionImport_Click);
            this.__mActionExport.Click  += new EventHandler(__mActionExport_Click);
            this.__mActionReplace.Click += new EventHandler(__mActionReplace_Click);
            this.__mActionDelete.Click  += new EventHandler(__mActionDelete_Click);
            this.__mActionCancel.Click  += new EventHandler(__mActionCancel_Click);

            this.__mToolsBatch.Click   += new EventHandler(__mToolsBatch_Click);
            this.__mToolsOptions.Click += new EventHandler(__mToolsOptions_Click);
            this.__mToolsPending.Click += new EventHandler(__mToolsPending_Click);

            this.__mHelpTopics.Click  += new EventHandler(__mHelpTopics_Click);
            this.__mHelpUpdates.Click += new EventHandler(__mHelpUpdates_Click);
            this.__mHelpAbout.Click   += new EventHandler(__mHelpAbout_Click);

            this.__t.ContextMenu = __c;

            this.__c.Popup += new EventHandler(__c_Popup);

            this.__cToolbar.Click      += new EventHandler(__cToolbar_Click);
            this.__cToolbarLarge.Click += new EventHandler(__cToolbarLarge_Click);
            this.__cToolbarSmall.Click += new EventHandler(__cToolbarSmall_Click);
            this.__cMenu.Click         += new EventHandler(__cMenu_Click);

            #endregion

            this._findForm.FindNextClicked += new EventHandler(_findForm_FindNextClicked);

            _history              = new System.Collections.Generic.Stack <NavigateItem>();
            this.__navBack.Click += new EventHandler(__navBack_Click);
            this.__navUp.Click   += new EventHandler(__navUp_Click);
            this.__tree.ImageList = MainForm.TypeImages16;

            _viewData = new ResourceDataView();
            _viewList = new ResourceListView();

            _viewList.ItemActivated       += new EventHandler <ResourceListViewEventArgs>(_viewList_ItemActivated);
            _viewList.SelectedItemChanged += new EventHandler <ResourceListViewEventArgs>(_viewList_SelectedItemChanged);
        }
        private void FirstNavCommandHandler()
        {
            ResourceListView.MoveCurrentToFirst();

            SelectedResource = (ResourceModel)ResourceListView.CurrentItem;
        }