コード例 #1
0
ファイル: GroupSplitter.cs プロジェクト: voidALPHA/cgc_viz
 protected virtual void DenoteEmptySelectedList(MutableObject mutable, MutableObject defaultObject)
 {
     if (!SelectedList.Any())
     {
         SelectedList.Add(defaultObject);
     }
 }
コード例 #2
0
        /// <summary>
        /// 数据初始化
        /// </summary>
        private void Init()
        {
            try
            {
                bool fileexist = System.IO.File.Exists(Server.MapPath("/Plugins/IPStrategyPlugin/Plugin.xml"));
                if (!fileexist)
                {
                    Messages.ShowMessage(string.Format("如果要管理IP策略请安装IP策略管理插件!<a href=\"javascript:window.top.location.href='/admin/Plugin/PluginAdd.aspx?tab=0&qtext={0}&qtype=1&ptype=PLUGIN';void(0);\">去安装</a>", HttpUtility.UrlEncode("IP策略管理")), true);
                }
                else
                {
                    bool isinstalled = new PluginInfo(Server.MapPath("/Plugins/IPStrategyPlugin/Plugin.xml")).IsInstalled;
                    if (!isinstalled)
                    {
                        Messages.ShowMessage("如果要管理IP策略请激活IP策略管理插件!<a href=\"javascript:window.top.location.href='/admin/Plugin/PluginList.aspx';void(0);\">去激活</a>", true);
                    }
                    else
                    {
                        Messages.ShowMessage("已激活IP策略管理插件!<a href=\"javascript:window.top.location.href='/Plugins/IPStrategyPlugin/UI/StrateList.aspx';void(0);\">去管理</a>", true);
                    }
                }
                switch (Mode)
                {
                case StrategyMode.ARTICLE:
                    IPStrategy = ArticleHelper.QueryStrategy(ArticleID);
                    break;

                case StrategyMode.CHANNEL:
                    IPStrategy = ChannelHelper.QueryStrategy(ChannelID);
                    break;

                case StrategyMode.CONVENTION:
                    bttnSave.Visible = false;
                    break;
                }

                UnSelectedList.AddRange(StrategyConfigs.Instance.Items);

                if (!String.IsNullOrEmpty(IPStrategy))
                {
                    String[] strtgyList = IPStrategy.Split("|".ToCharArray());
                    foreach (string strtgy in strtgyList)
                    {
                        StrategyInfo info = StrategyConfigs.Instance[strtgy];
                        if (!String.IsNullOrEmpty(strtgy) && info != null)
                        {
                            SelectedList.Add(info);
                            Remove(UnSelectedList, info);
                            //UnSelectedList.Remove(info);
                        }
                    }
                }

                bindData();
            }
            catch (Exception ex)
            {
                Messages.ShowError("数据初始化出错!<Br />错误原因:" + ex.Message);
            }
        }
コード例 #3
0
 protected void bttnRight_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (ListItem item in lstUnSelected.Items)
         {
             if (item.Selected)
             {
                 StrategyInfo info = StrategyConfigs.Instance[item.Value.Trim()];
                 if (info == null)
                 {
                     continue;
                 }
                 SelectedList.Add(info);
                 //UnSelectedList.Remove(info);
                 Remove(UnSelectedList, info);
             }
         }
         bindData();
     }
     catch (Exception ex)
     {
         Messages.ShowError("当前操作出错!<br />详细信息:" + ex.Message);
     }
 }
コード例 #4
0
ファイル: MetaSelectionSet.cs プロジェクト: voidALPHA/cgc_viz
        public IEnumerator SelectOnly(IEnumerable <VisualPayload> payloads)
        {
            IEnumerator iterator;

            UnSelectedList.AddRange(SelectedList);
            SelectedList.Clear();

            foreach (var payload in payloads)
            {
                UnSelectedList.Remove(payload);
                SelectedList.Add(payload);

                payload.VisualData.Bound.ClearBounds();

                iterator = SelectedState.Transmit(payload);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }

            iterator = SendUnselected();
            while (iterator.MoveNext())
            {
                yield return(null);
            }

            iterator = TransmitMultiStates();
            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
コード例 #5
0
ファイル: MetaSelectionSet.cs プロジェクト: voidALPHA/cgc_viz
        public IEnumerator Select(VisualPayload payload)
        {
            bool sendNormal = !SelectedList.Any();

            UnSelectedList.Remove(payload);

            SelectedList.Add(payload);

            payload.VisualData.Bound.ClearBounds();

            var iterator = SelectedState.Transmit(payload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }

            if (sendNormal)
            {
                iterator = SendUnselected();
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }

            iterator = TransmitMultiStates();
            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
コード例 #6
0
        private void btnMoveRight_Click(object sender, RoutedEventArgs e)
        {
            int old = lvLeft.SelectedIndex; // this is used to preserve the user's previous position in the list

            foreach (RecordEntitySetting l in this.lvLeft.SelectedItems)
            {
                SelectedList.Add(l);
                l.IsRecorded = true;
            }

            UpdateListViews();
            lvLeft.SelectedIndex = old < lvLeft.Items.Count ? old : lvLeft.Items.Count - 1;
        }
コード例 #7
0
        public void DeSelectFile_Click(object sender, EventArgs e)
        {
            List <FileItem> temp = new List <FileItem>();

            foreach (FileItem item in SelectedList)
            {
                temp.Add(item);
            }
            foreach (FileItem item in SelectedFilesListBox.SelectedItems)
            {
                temp.Remove(item);
            }
            SelectedList.Clear();
            temp.ForEach((item) => { SelectedList.Add(item); });
        }
コード例 #8
0
ファイル: MetaSelectionSet.cs プロジェクト: voidALPHA/cgc_viz
        public IEnumerator Select(IEnumerable <VisualPayload> payloads)
        {
            if (!payloads.Any())
            {
                yield return(null);

                yield break;
            }

            bool sendNormal = !SelectedList.Any();

            IEnumerator iterator;

            foreach (var payload in payloads)
            {
                if (SelectedList.Contains(payload))
                {
                    continue;
                }

                UnSelectedList.Remove(payload);
                SelectedList.Add(payload);

                payload.VisualData.Bound.ClearBounds();

                iterator = SelectedState.Transmit(payload);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }

            if (sendNormal)
            {
                iterator = SendUnselected();
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }

            iterator = TransmitMultiStates();
            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
コード例 #9
0
        /// <summary>
        /// Switch listviewitem side on doubleclick
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var lvi      = sender as ListViewItem;
            var listView = ItemsControl.ItemsControlFromItemContainer(lvi) as ListView;
            var records  = from l in this.List where l.Id == (lvi.Content as RecordEntitySetting).Id select l;
            var record   = records.FirstOrDefault();

            if (listView == lvLeft)
            {
                SelectedList.Add(record);
                record.IsRecorded = true;
            }
            else
            {
                SelectedList.Remove(lvi.Content as RecordEntitySetting);
                record.IsRecorded = false;
            }
            UpdateListViews();
        }
コード例 #10
0
        /// <summary>
        /// Updates subject ScholarlyworkItem to selected CategoryNodes association.
        /// </summary>
        /// <returns>true, if successful; else false.</returns>
        public bool SaveAssociation()
        {
            bool result = false;

            if (TreeView.Nodes.Count != 0)
            {
                for (int Index = 0; Index < TreeView.CheckedNodes.Count; Index++)
                {
                    SelectedIdList.Add(new Guid(TreeView.CheckedNodes[Index].Value));
                }

                using (ResourceDataAccess dataAccess = new ResourceDataAccess(base.CreateContext()))
                {
                    List <CategoryNode> categoryNodeList = new List <CategoryNode>();
                    categoryNodeList = dataAccess.GetCategoryNodeList(SelectedIdList);

                    foreach (CategoryNode node in categoryNodeList)
                    {
                        SelectedList.Add(node);
                    }

                    AuthorizeResourcesBeforeSave(dataAccess);

                    result = dataAccess.SaveScholarlyItemCategoryAssociation(ResourceItemId,
                                                                             SelectedList as IList <Zentity.ScholarlyWorks.CategoryNode>, AuthenticatedToken, Constants.PermissionRequiredForAssociation);
                }
                if (result)
                {
                    HeaderMessageLabel.Visible = true;
                    ShowMessage(GlobalResource.MsgCategoryNodeAssociationSuccessfull, false);
                }
            }
            else
            {
                HeaderMessageLabel.Visible = true;
                ShowMessage(GlobalResource.MsgCategoryNodeNotFound, false);
                result = false;
            }
            return(result);
        }
コード例 #11
0
 public void SelectFile_Click(object sender, EventArgs e)
 {
     //List<FileItem> tempList = new List<FileItem>(DirectoryListBox.SelectedItems.Count);
     foreach (FileItem item in DirectoryListBox.SelectedItems)
     {
         bool isExisting = false;
         foreach (var selectedFileItem in SelectedList)
         {
             if (selectedFileItem.Name == item.Name)
             {
                 isExisting = true;
             }
         }
         if (isExisting)
         {
             System.Windows.Forms.MessageBox.Show("File with same name already exists, please try another file");
             return;
         }
         SelectedList.Add(item);
     }
     SelectedFilesListBox.ItemsSource = SelectedList;
     DirectoryListBox.SelectedIndex   = -1;
 }
コード例 #12
0
        protected override void SelectGroups(List <MutableObject> entry)
        {
            SelectedList.Clear();
            UnSelectedList.Clear();

            var maintainCountAtEdges = MaintainCountAtEdgesField.GetLastKeyValue(entry.Last());

            var entries      = EntryField.GetEntries(entry);
            var entriesCount = entries.Count();

            if (entriesCount == 0)
            {
                Debug.LogError("What?  Empty entries?");
            }

            var beforeWidth = SelectBeforeCount.GetLastKeyValue(entry.Last());
            var afterWidth  = SelectAfterCount.GetLastKeyValue(entry.Last());

            var lowerBound = maintainCountAtEdges?Mathf.Min(beforeWidth, entriesCount - 1):0;
            var upperBound = maintainCountAtEdges ? Mathf.Max(entriesCount - afterWidth - 1, 0) : entriesCount - 1;

            if (lowerBound >= upperBound)
            {
                // use the lower of the two values for both bounds to avoid overlap
                lowerBound = Mathf.Min(lowerBound, upperBound);
                upperBound = Mathf.Min(lowerBound, upperBound);
            }

            var index = Mathf.Clamp(CenterIndex.GetLastKeyValue(entry.Last()),
                                    lowerBound, upperBound);

            var minIndex = Mathf.Max(index - beforeWidth, 0);
            var maxIndex = Mathf.Min(index + afterWidth, entriesCount - 1);

            //var i = 0;
            //foreach ( var entry in entries )
            //{
            //    if ( i < minIndex )
            //    UnSelectedList.
            //}

            bool selectedListOnly = SelectedListOnly.GetValue(entry);

            int currentIndex = 0;

            if (selectedListOnly)
            {
                foreach (var subEntry in EntryField.GetEntries(entry))
                {
                    if (currentIndex > maxIndex)
                    {
                        break;
                    }
                    if (currentIndex >= minIndex)
                    {
                        SelectedList.Add(subEntry.Last());
                    }
                    currentIndex++;
                }
            }
            else
            {
                foreach (var subEntry in EntryField.GetEntries(entry))
                {
                    if (currentIndex < minIndex || currentIndex > maxIndex)
                    {
                        UnSelectedList.Add(subEntry.Last());
                    }
                    else
                    {
                        SelectedList.Add(subEntry.Last());
                    }

                    currentIndex++;
                }
            }
        }