/// <summary>
        /// O(log(n))
        /// </summary>
        /// <param name="key"></param>
        public void Remove(TKey key)
        {
            LinkedListNode <KeyValuePair <TKey, TValue> > llNode = sortedList[key]; //O(log(n))

            linkedList.Remove(llNode);                                              //O(1)
            sortedList.Remove(key);                                                 //O(log(n))
        }
Beispiel #2
0
        public void UpdateKey(TKey oldKey, TKey newKey)
        {
            var item = FSortedList[oldKey];

            FSortedList.Remove(oldKey);
            FSortedList.Add(newKey, item);

            OnOrderChanged();
        }
Beispiel #3
0
        public bool Add(string filename, Kom2SubFile subfile, bool overwrite)
        {
            if (subfiles.ContainsKey(filename))
            {
                if (overwrite == false)
                {
                    return(false);
                }

                subfiles.Remove(filename);
            }
            subfiles.Add(filename, subfile);
            return(true);
        }
Beispiel #4
0
        private void Sbtn_Click(object sender, EventArgs e)
        {
            DevExpress.XtraEditors.SimpleButton sbtn = sender as DevExpress.XtraEditors.SimpleButton;
            if (sbtn != null &&
                sbtn.Tag != null)
            {
                IsNewCommand    = false;
                IsEditCommand   = false;
                IsLoadCommand   = false;
                IsDeleteCommand = false;
                IsClearCommand  = false;
                IsExitCommand   = false;
                bool isChs = (LangVersion == ProCommon.Communal.Language.Chinese);

                switch (sbtn.Tag.ToString())
                {
                case "SBTN_NEWROUTINE":
                    CreateNewRoutine();
                    this.Close();
                    break;

                case "SBTN_EDITROUTINE":
                {
                    //当前程式更新为选中程式,然后进入编辑状态
                    if (this.lstbRoutine.SelectedItem != null)
                    {
                        RoutineName = this.lstbRoutine.SelectedItem.ToString();
                        RoutineDirectorySelected = _routineNamesAndDirectories[RoutineName];
                        IsEditCommand            = true;
                        this.Close();
                    }
                }
                break;

                case "SBTN_LOADROUTINE":
                {
                    //当前程式更新为选中程式,加载程式参数
                    if (this.lstbRoutine.SelectedItem != null)
                    {
                        RoutineName = this.lstbRoutine.SelectedItem.ToString();
                        RoutineDirectorySelected = _routineNamesAndDirectories[RoutineName];
                        IsLoadCommand            = true;
                        this.Close();
                    }
                }
                break;

                case "SBTN_DELETEROUTINE":
                {
                    //当前程式更新为空,且选中程式对应的文件(或文件夹)被删除
                    if (this.lstbRoutine.SelectedItem != null)
                    {
                        RoutineName = this.lstbRoutine.SelectedItem.ToString();
                        RoutineDirectorySelected = _routineNamesAndDirectories[RoutineName];
                        if (System.IO.Directory.Exists(RoutineDirectorySelected))
                        {
                            try
                            {
                                System.IO.Directory.Delete(RoutineDirectorySelected, true);
                                _routineNamesAndDirectories.Remove(RoutineName);
                                UpdateListBoxForRoutine();
                                IsDeleteCommand = true;
                            }
                            catch { }
                        }
                    }
                }
                break;

                case "SBTN_CLEARROUTINE":
                    ClearRoutines();
                    break;

                case "SBTN_EXIT":
                {
                    //退出当前管理对话框
                    string txt     = isChs ? "是否退出程式管理?" : "Cancel the dialog of routine manager ?";
                    string caption = isChs ? "询问信息" : "Question Message";
                    if (ProCommon.DerivedForm.FrmMsgBox.Show(txt, caption,
                                                             ProCommon.DerivedForm.MyButtons.OKCancel,
                                                             ProCommon.DerivedForm.MyIcon.Question, isChs) == DialogResult.OK)
                    {
                        this.Close();
                    }
                }
                break;

                case "SBTN_SEARCH":
                {
                    //获取搜索框提供的程式名称,非空程式名时在已有程式列表中搜索同名程式
                    //弹窗提示搜索结果,搜索到匹配名称的程式时,关闭提示窗后再在列表匹配名称处高亮显示(鼠标焦点)
                }
                break;

                default: break;
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// Removes an integer value from the collection.
 /// </summary>
 /// <param name="nValue">The integer value to remove.</param>
 public void Remove(int nValue)
 {
     _list.Remove(nValue);
 }
 public void AddKeyframe(int frame, TrackingInfo info)
 {
     keyframes.Remove(frame);
     keyframes.Add(frame, info);
 }
Beispiel #7
0
 internal void RemovePermission(string username)
 {
     entries.Remove(username);
 }
Beispiel #8
0
        internal void Remove(ToolBox toolbox)
        {
            // Write out our change
            string  currentIniFilename = toolbox.GetCurrentIniFilenameFromLocation(Location);
            MOG_Ini pIni = new MOG_Ini();

OpenConfigIni:
            if (pIni.Open(currentIniFilename, FileShare.Write))
            {
                // Remove this control from the siblings
                mSiblings.Remove(VisibleIndex);

                // Go thru all of this controls siblings and move their visual index up one so that there is not a break in the chain
                foreach (KeyValuePair <int, ControlDefinition> sibling in mSiblings)
                {
                    // Is this guy visually after the one we are deleting?
                    if (sibling.Value.VisibleIndex > VisibleIndex)
                    {
                        // Then move it up one
                        sibling.Value.VisibleIndex = sibling.Value.VisibleIndex - 1;

                        // Make sure this section actually exists
                        if (pIni.SectionExist(sibling.Value.ControlGuid))
                        {
                            pIni.PutString(sibling.Value.ControlGuid, VisisbleIndex_Key, sibling.Value.VisibleIndex.ToString());
                        }
                    }
                }

                pIni.RemoveSection(ControlGuid);

                // Scan all the sections looking for any related subsections
                ArrayList relatedSubSections = new ArrayList();
                string    subControlGuid     = ControlGuid + SubSectionIndicator_Text;
                foreach (string section in pIni.GetSections(null))
                {
                    if (section.StartsWith(subControlGuid, StringComparison.CurrentCultureIgnoreCase))
                    {
                        // Schedule this subsection for removal
                        relatedSubSections.Add(section);
                    }
                }
                // Remove any subsections related to this control
                foreach (string section in relatedSubSections)
                {
                    pIni.RemoveSection(section);
                }

                pIni.Save();
                pIni.Close();
            }
            else
            {
                if (
                    MOG_Prompt.PromptResponse("Configuration locked!",
                                              "Configuration file for this control is currently in use by another user",
                                              MOGPromptButtons.RetryCancel) == MOGPromptResult.Retry)
                {
                    goto OpenConfigIni;
                }
            }
        }