Esempio n. 1
0
        public void RemoveSelectedMemos()
        {
            if (_memoListBox.SelectedItems.Count == 0)
            {
                return;
            }

            var selecteds = new MemoInfo[_memoListBox.SelectedItems.Count];

            if (selecteds.Length > 0)
            {
                for (int i = 0, len = selecteds.Length; i < len; ++i)
                {
                    selecteds[i] = (MemoInfo)_memoListBox.SelectedItems[i];
                }
            }

            if (!MessageUtil.ConfirmMemoRemoval(selecteds))
            {
                return;
            }

            _memoListBox.BeginUpdate();
            foreach (var item in selecteds)
            {
                var info = (MemoInfo)item;
                _app.RemoveMemo(info);
            }
            _memoListBox.EndUpdate();
        }
        public void RemoveMemo(bool completely)
        {
            var selectedNode = _tree.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }

            if (selectedNode != _root)
            {
                var selected = selectedNode.Tag as Memo;
                if (selected != null)
                {
                    /// viewから消してContaineingFolderから削除
                    _tree.BeginUpdate();
                    var parentNode   = selectedNode.Parent;
                    var parentFolder = (MemoFolder)parentNode.Tag;
                    selectedNode.Remove();
                    parentFolder.RemoveContainingMemo(selected);
                    if (completely)
                    {
                        _facade.RemoveMemo(_facade.FindMemoInfo(selected));
                    }
                    _tree.SelectedNode = parentNode;
                    _tree.EndUpdate();
                }
            }
        }
        public bool RemoveMemo(string memoId)
        {
            var ret = _facade.MainForm.Invoke(
                (Func <bool>)(() => {
                var info = _facade.FindMemoInfoByMemoId(memoId);
                return(_facade.RemoveMemo(info));
            })
                );

            if (ret is bool)
            {
                return((bool)ret);
            }
            else
            {
                return(false);
            }
        }