Exemplo n.º 1
0
        public MetaListItemInfo(XElement node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            _path     = node.GetValue("id");
            _parent   = node.GetValue("parent_id");
            _modified = node.GetValue("updated_time");
            var type = node.GetValue("type");

            if (string.IsNullOrEmpty(type))
            {
                type = "file";
            }
            _isDir = "folder|album".Contains(type); // Show folder icon in case of folder/album
            int.TryParse(node.GetValue("size"), out _size);

            Title = node.GetValue("name") ?? "";
            Notes = GetRelativeTime(_modified);
            string iconStr = "";

            iconStr = Title.EndsWith(".kdbx", StringComparison.InvariantCultureIgnoreCase) // If its keepass database
                ? "keepasslogo"
                : (_isDir
                    ? "folder"
                    : "entry");

            Icon = ThemeData.GetImage(iconStr);
        }
Exemplo n.º 2
0
        public ParentItem(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            _path = path;
            Title = "Parent Folder";
            Icon  = ThemeData.GetImage("parent");
        }
Exemplo n.º 3
0
        public MetaListItemInfo(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            _path     = path;
            _isDir    = true;
            _modified = string.Empty;

            Title = "Parent Folder";
            Icon  = ThemeData.GetImage("parent");
        }
Exemplo n.º 4
0
        public MetaListItemInfo(MetaData data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            _path     = data.Path;
            _isDir    = data.Is_Dir;
            _modified = data.Modified;

            Title = data.Name;
            Notes = GetRelativeTime(data);
            Icon  = ThemeData.GetImage(
                data.Is_Dir ? "folder" : "entry");
        }
Exemplo n.º 5
0
        public MetaListItemInfo(XElement node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            _path     = node.GetValue("id");
            _parent   = node.GetValue("parent_id");
            _modified = node.GetValue("updated_time");
            _isDir    = node.GetValue("type") == "folder";

            Title = node.GetValue("name");
            Notes = GetRelativeTime(_modified);
            Icon  = ThemeData.GetImage(_isDir
                ? "folder" : "entry");
        }
Exemplo n.º 6
0
        private void Refresh()
        {
            SetMoveState();
            lblTarget.Text = GetPath(_target);

            var dispatcher = Dispatcher;

            ThreadPool.QueueUserWorkItem(_ =>
            {
                var groups = _target.Groups
                             .ToList();

                if (_group != null)
                {
                    groups.Remove(_group);
                }

                var recycleBin = _database
                                 .RecycleBin;

                if (recycleBin != null)
                {
                    groups.Remove(recycleBin);
                }

                var items = new List <GroupItem>();

                items.AddRange(groups
                               .OrderBy(x => x.Name)
                               .Select(x => new GroupItem(
                                           x, dispatcher)));

                if (_target.Parent != null)
                {
                    items.Insert(0, new GroupItem(
                                     _target.Parent, dispatcher)
                    {
                        Icon = ThemeData.GetImage("up"),
                    });
                }

                lstGroup.SetItems(items);
            });
        }
Exemplo n.º 7
0
        public MetaListItemInfo(string basePath, ItemInfo item)
        {
            if (basePath == null)
            {
                throw new ArgumentNullException("basePath");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            _item = item;
            _path = new Uri(new Uri(basePath),
                            item.Path).ToString();

            Title = GetTitle(item);
            Notes = GetRelativeTime(item);
            Icon  = ThemeData.GetImage(item.IsDir
                ? "folder" : "entry");
        }
Exemplo n.º 8
0
        public GroupItem(Entry entry, Dispatcher dispatcher)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            Title = entry.Title;
            Notes = entry.UserName;
            Icon  = ThemeData.GetImage("entry");

            Overlay = Cache.GetOverlay(
                dispatcher, entry.Icon);

            _data      = entry;
            _targetUri = Navigation.GetPathTo
                         <EntryDetails>("id={0}", entry.ID);
        }
Exemplo n.º 9
0
        public GroupItem(Group group, Dispatcher dispatcher)
        {
            if (group == null)
            {
                throw new ArgumentNullException("group");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            Title = group.Name;
            Notes = group.Notes;
            Icon  = ThemeData.GetImage("folder");

            Overlay = Cache.GetOverlay(
                dispatcher, group.Icon);

            _data      = group;
            _targetUri = Navigation.GetPathTo
                         <GroupDetails>("id={0}", group.ID);
        }