Exemple #1
0
        public void Test_Tag_Int()
        {
            var tag   = new TagItem(30);
            var value = tag.AsInt32();

            Assert.True(value == 30);
        }
Exemple #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                bool isDeleted = false;

                foreach (GridDataItem data in grid.SelectedItems)
                {
                    int tagId = Convert.ToInt32(data.GetDataKeyValue("TagId"));
                    Tag tag   = new Tag(tagId);

                    if (tag != null && tag.TagId > -1)
                    {
                        ContentLanguage.DeleteByContent(tag.Guid);
                        TagItem.DeleteByTag(tag.TagId);
                        Tag.Delete(tagId);

                        LogActivity.Write("Delete product tag", tag.TagText);

                        isDeleted = true;
                    }
                }

                if (isDeleted)
                {
                    message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage");
                    WebUtils.SetupRedirect(this, Request.RawUrl);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
Exemple #3
0
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            // perform a hit test and display the tag under the mouse pointer as it moves
            TagItem hit = canvas.HitTest(e.Location);

            lblHit.Text = (hit != null) ? hit.Text : "(none)";
        }
Exemple #4
0
        public bool follow(string tagId, string userId)
        {
            _logger.LogDebug("tagid:" + tagId);
            TagItem tagItem = _tagService.Get(tagId);

            if (tagItem == null)
            {
                return(false);
            }
            User user = Get(userId);

            _logger.LogDebug("user id:" + userId);
            if (user == null)
            {
                return(false);
            }
            _logger.LogDebug("ok");

            List <string> followedTags = Utility.Tokenize(user.tags).ToList();

            if (!followedTags.Contains(tagItem.name))
            {
                _logger.LogDebug("updating information");
                user.tags += " " + tagItem.name;
                Update(user.id, user);

                tagItem.users++;
                _tagService.Update(tagItem.id, tagItem);
            }

            return(true);
        }
        public TagsViewModel SearchResult(int currentUmbracoPageId, string tagText)
        {
            var _model = new TagsViewModel();

            var current = _umbracoHelper.TypedContent(currentUmbracoPageId);

            _model.articleListWithTag = new ArticleListWithTag(current);
            var mainNode        = current.AncestorOrSelf(2);
            var informationNode = mainNode.Descendant(DocumentTypeEnum.Information.ToString());

            var _newsNode = _umbracoHelper.TypedContent(informationNode.Id);
            var _newsList = _newsNode.Children.Where("Visible").Select(q => new ArticleWithDoubleFiltr(q));

            _model.NewsBoxesList = new List <TagItem>();
            foreach (var item in _newsList)
            {
                if (item.ArticleTag != null && item.ArticleTag.ToString().Contains(tagText))
                {
                    TagItem tagItem = new TagItem()
                    {
                        TagName = item.ArticleTitle,
                        Tagdesc = item.ListShortDescArticle.ToString(),
                        TagUrl  = item.Url
                    };
                    _model.NewsBoxesList.Add(tagItem);
                }
            }
            _model.TagText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tagText);
            return(_model);
        }
Exemple #6
0
        public void BuildNewsTagsXml(XmlDocument doc, XmlElement root)
        {
            string siteRoot = WebUtils.GetSiteRoot();

            int    defaultLanguageId = -1;
            string defaultCulture    = WebConfigSettings.DefaultLanguageCulture;

            if (defaultCulture.Length > 0)
            {
                defaultLanguageId = LanguageHelper.GetLanguageIdByCulture(defaultCulture);
            }

            XmlElement element = doc.CreateElement("NewsTags");

            root.AppendChild(element);
            List <TagItem> lstTagItems = TagItem.GetByItem(news.NewsGuid);

            foreach (TagItem tagItem in lstTagItems)
            {
                XmlElement elementTag = doc.CreateElement("NewsTag");
                element.AppendChild(elementTag);
                XmlHelper.AddNode(doc, elementTag, "TagId", tagItem.TagId.ToInvariantString());
                XmlHelper.AddNode(doc, elementTag, "Tag", tagItem.TagText);
            }
        }
 public EditTagWnd(TagItem item)
 {
     _tagItem = item;
     InitializeComponent();
     _tagItem.BeginEdit();
     DataContext = _tagItem;
 }
Exemple #8
0
        //private Dictionary<Int32, ModuleTags> GetPermissions(Person person, Boolean forOrganization)
        //{
        //    Dictionary<Int32, ModuleTags> permissions = new Dictionary<Int32, ModuleTags>();
        //    List<Organization> organizations = ServiceCommunityManagement.GetAvailableOrganizations(person.Id, SearchCommunityFor.Subscribed);
        //    permissions.Add(-3, ModuleTags.CreatePortalmodule(person.TypeID));

        //    if (organizations != null && organizations.Any())
        //    {
        //        if (person.TypeID == (int)UserTypeStandard.SysAdmin || person.TypeID == (int)UserTypeStandard.Administrator)
        //            organizations.ForEach(o => permissions.Add(o.Id, permissions[-3]));
        //        else
        //        {
        //            List<Int32> communities = (from c in Manager.GetIQ<liteCommunityInfo>()
        //                                       where c.IdFather == 0
        //                                           && organizations.Where(o => o.Id == c.IdOrganization).Any()
        //                                       select c.Id).ToList();
        //            communities.ForEach(c => permissions.Add(c., GetPermission(c)));
        //        }
        //    }
        //    return permissions;
        //}

        public TagItem SetStatus(long idTag, lm.Comol.Core.Dashboard.Domain.AvailableStatus status)
        {
            TagItem item = null;

            try
            {
                litePerson person = Manager.GetLitePerson(UC.CurrentUserID);
                if (person != null && person.TypeID != (int)UserTypeStandard.Guest && person.TypeID != (int)UserTypeStandard.PublicUser)
                {
                    item = Manager.Get <TagItem>(idTag);
                    item.UpdateMetaInfo(person, UC.IpAddress, UC.ProxyIpAddress);
                    Manager.BeginTransaction();
                    item.Status = status;
                    Manager.Commit();
                    if (item.Type == TagType.Community)
                    {
                        CacheHelper.PurgeCacheItems(CacheKeys.AllCommunityTags);
                        CacheHelper.PurgeCacheItems(CacheKeys.AllUserCommunitiesTags);
                    }
                    CacheHelper.PurgeCacheItems(CacheKeys.Tags(item.Type));
                    if (item.MyTile.Status != Dashboard.Domain.AvailableStatus.Available && status != Dashboard.Domain.AvailableStatus.Draft)
                    {
                        ServiceDashboard.TileSetStatus(item.MyTile, status);
                    }
                }
            }
            catch (Exception ex)
            {
                Manager.RollBack();
            }
            return(item);
        }
        static private bool HandleDocTagCompletion(ScintillaNet.ScintillaControl Sci)
        {
            if (ASContext.CommonSettings.JavadocTags == null || ASContext.CommonSettings.JavadocTags.Length == 0)
            {
                return(false);
            }

            string txt = Sci.GetLine(Sci.LineFromPosition(Sci.CurrentPos)).TrimStart();

            if (!Regex.IsMatch(txt, "^\\*[\\s]*\\@"))
            {
                return(false);
            }

            // build tag list
            if (docVariables == null)
            {
                docVariables = new List <ICompletionListItem>();
                TagItem item;
                foreach (string tag in ASContext.CommonSettings.JavadocTags)
                {
                    item = new TagItem(tag);
                    docVariables.Add(item);
                }
            }

            // show
            CompletionList.Show(docVariables, true, "");
            return(true);
        }
Exemple #10
0
        public TagItem ValidateAndReturn(string tag)
        {
            if (string.IsNullOrWhiteSpace(tag))
            {
                return(null);
            }

            var tagString = tag.StartsWith("#") ? tag : "#" + tag;

            try
            {
                if (Items.Any(v => v.Name.Equals(tagString, StringComparison.OrdinalIgnoreCase)))
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error: " + ex.Message);
                Debug.WriteLine("Error Full: " + ex);
                return(null);
            }



            var newTag = new TagItem()
            {
                Name = tagString.ToLower()
            };

            //Items.Add(newTag);

            return(newTag);
        }
Exemple #11
0
        // Adds name TagItem to controls collection
        public void AddItem(TagItem item)
        {
            values.Add(item);
            AddLabel(item);

            RefreshTags();
        }
        public static List<TagItem> GetTagsList(TagFilesDatabase currentDb, TagsCombinaton tagsCombination, string searchText)
        {
            if (currentDb == null) return null;

            List<TagItem> ret = new List<TagItem>();
            // Add each tag from the database
            for (int i = 0; i < currentDb.Tags.Count; i++)
            {
                // Extract the tag
                FileTag tag = currentDb.Tags[i];

                // Show the tag only if it's not in the history of tags being selected - 
                // (You should not show tag 'X' after selecting tag 'X')                                    
                if (!tagsCombination.ContainsByValue(tag, false) && tag.Value.ToLower().Contains(searchText.ToLower()))
                {
                    TagItem item = new TagItem();
                    // Set the tag item (including text of the tag with the tag's file-count                    
                    item.Text = (tag.Value == "" ? No_Tags_String : tag.ToString()) +
                        "\n  [" + currentDb.CountFilesByTag(tag).ToString() + "]";
                    item.RawFileTag = tag;

                    // Map the tag to it's group
                    int groupKeyIndex = currentDb.tagGroupMapping[i];
                    item.GroupName = currentDb.groupsNames[groupKeyIndex];
                    item.GroupKey = currentDb.groupsKeys[groupKeyIndex];

                    ret.Add(item);
                }
            }
            return ret;
        }
Exemple #13
0
 private Func<BaseTagReader> getTypeFromTree(TagItem Root)
 {
     // wenn eine detections methode erfolgreich war
     if (Root.Value.DetectionFunction(CurrentStream))
     {
         // muss ich im unterbraum weiter suchen
         // wenn er kinder hat
         if (Root.Children != null)
         {
             // dann muss ich sie durch iterieren
             foreach (TagItem child in Root.Children)
             {
                 var childResult = getTypeFromTree(child);
                 if (childResult != null)
                     return childResult;
             }
         }
         else // sonst
         {
             // bin ich fertig und muss den erzeuger zurück geben
             return Root.Value.Create;
         }
     }
     return null;
 }
        public virtual void Disassemble(Action <TagItem> callback)
        {
            long position = (8 + Frame.Area.GetByteSize() + 4);

            while (position != FileLength)
            {
                var header = new HeaderRecord(_input);
                position += (header.IsLongTag ? 6 : 2);
                long offset = (header.Length + position);

                TagItem tag = ReadTag(header, _input);
                position += tag.GetBodySize();

                if (position != offset)
                {
                    throw new IOException($"Expected position value '{offset}', instead got '{position}'.");
                }
                callback?.Invoke(tag);
                Tags.Add(tag);

                if (tag.Kind == TagKind.End)
                {
                    FileLength = (uint)position;
                    break;
                }
            }
        }
        public virtual void Disassemble(Action <TagItem> callback)
        {
            if (_input.IsDisposed)
            {
                throw new ObjectDisposedException(nameof(_input), "Input stream has already been disposed, or disassembly of the file has already occured.");
            }
            long position = (8 + Frame.Area.GetByteSize() + 4);

            while (position != FileLength)
            {
                var header = new HeaderRecord(_input);
                position += (header.IsLongTag ? 6 : 2);
                long offset = (header.Length + position);

                TagItem tag = ReadTag(header, _input);
                position += tag.GetBodySize();

                if (position != offset)
                {
                    throw new IOException($"Expected position value '{offset}', instead got '{position}'.");
                }
                callback?.Invoke(tag);
                Tags.Add(tag);

                if (tag.Kind == TagKind.End)
                {
                    break;
                }
            }
            _input.Dispose();
        }
        static private bool HandleDocTagCompletion(ScintillaNet.ScintillaControl Sci)
        {
            string txt = Sci.GetLine(Sci.LineFromPosition(Sci.CurrentPos)).TrimStart();

            if (!Regex.IsMatch(txt, "^\\*[\\s]*\\@"))
            {
                return(false);
            }
            DebugConsole.Trace("Documentation tag completion");

            // build tag list
            if (docVariables == null)
            {
                docVariables = new ArrayList();
                TagItem  item;
                string[] tags = ASContext.DocumentationTags.Split(' ');
                foreach (string tag in tags)
                {
                    item = new TagItem(tag);
                    docVariables.Add(item);
                }
            }

            // show
            CompletionList.Show(docVariables, true, "");
            return(true);
        }
        private void listViewSvc_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            TagItem ti = listViewSvc.Items[e.Index].Tag as TagItem;

            if (ti.SetByCode)
            {
                ti.SetByCode = false;
                return;
            }
            if (!ti.Item.Enabled)
            {
                e.NewValue = e.CurrentValue;
                return;
            }

            if (e.NewValue == CheckState.Checked)
            {
                bool bOk = EnumUtil.TurnOnBits(ref m_Value, ti.Item.Value);
            }
            else
            {
                bool bOk = EnumUtil.TurnOffBits(ref m_Value, ti.Item.Value);
            }

            e.NewValue = e.CurrentValue;
            UpdateCheckState( ); // this will change the check box on the list view item
        }
Exemple #18
0
        public bool Unfollow(string tagId, string userId)
        {
            TagItem tagItem = _tagService.Get(tagId);

            if (tagItem == null)
            {
                return(false);
            }
            User user = Get(userId);

            if (user == null)
            {
                return(false);
            }

            List <string> followedTags = Utility.Tokenize(user.tags).ToList();

            if (followedTags.Contains(tagItem.name))
            {
                //user.tags += tagItem.name;
                followedTags.Remove(tagItem.name);
                user.tags = Utility.ArrayToString(followedTags);
                Update(user.id, user);

                tagItem.users--;
                _tagService.Update(tagItem.id, tagItem);
            }

            return(true);
        }
Exemple #19
0
 private void TagCallBack(TagItem obj)
 {
     if (obj.CBType == TagItem.CallBackType.AsyncRead)
     {
         //异步读回调
         Msg("异步读成功");
         LbReadValue.Dispatcher.Invoke(new Action(() => { LbReadValue.Content = obj.Value; }));
     }
     else if (obj.CBType == TagItem.CallBackType.AsyncWrite)
     {
         //异步写完成回调
         Msg("异步写成功");
     }
     else
     {
         //订阅回调
         foreach (var item in tagModals)
         {
             if (item.ServerID == obj.ServerId)
             {
                 item.Value     = obj.Value.ToString();
                 item.Quality   = obj.Quality;
                 item.Timesnamp = obj.Timestamp.ToString("yyyy-mm-dd HH:mm:ss:fff");
             }
         }
     }
 }
Exemple #20
0
        private void UpdateMonthRecordsByTag(TagItem tagItem)
        {
            var recordsByTag = new List <Record>();
            var tagItems     = new List <TagItem>(TagItems.ToList());

            if (tagItem != null)
            {
                tagItems.Add(tagItem);
            }

            if (tagItems.Count == 0 && recordsByTag.Count == 0)
            {
                MonthRecordsByTag = MonthRecords;
            }
            else
            {
                foreach (var tag in tagItems)
                {
                    var records = MonthRecords.FindAll((r) => string.Compare(r.Name, tag.Name) == 0);
                    foreach (var record in records)
                    {
                        recordsByTag.Add(record);
                    }
                }

                MonthRecordsByTag = recordsByTag.Distinct().ToList();
            }
        }
        public ActionResult ArticlePublishedOption(int articleid)
        {
            ArticleViewModel articleVM   = null;
            ArticleItem      articleItem = null;
            DataAccessLayer  datalayer   = null;
            List <TagItem>   tags        = null;

            //Guid userId;

            articleVM = new ArticleViewModel();

            if (Session["UserProfile"] != null)
            {
                UserProfileItem userprofile = (UserProfileItem)Session["UserProfile"];
                //articleVM.Userprofile = userprofile;
                //userId = userprofile.ID;

                datalayer   = new DataAccessLayer();
                articleItem = datalayer.GetArticlePublishedDetails(articleid, userprofile.ID);

                if (articleItem != null)
                {
                    articleVM.ArticleItem = articleItem;

                    if (!string.IsNullOrEmpty(articleItem.Tag_Article))
                    {
                        tags = new List <TagItem>();
                        var tagSplit = articleItem.Tag_Article.Split(',');
                        for (var i = 0; i < tagSplit.Length - 1; i++)
                        {
                            TagItem tagitem = new TagItem {
                                id = i, name = tagSplit[i]
                            };
                            tags.Add(tagitem);
                        }
                        articleVM.ArticleItem.Tags = tags;
                    }
                }
                else
                {
                    articleVM             = new ArticleViewModel();
                    articleVM.ArticleItem = new ArticleItem();
                    ModelState.AddModelError("", "Article Not Exist or Some error occured while fetching article details.");
                    StringBuilder script = new StringBuilder();
                    script.Append("<script type='text/javascript'>");
                    script.Append("$('#error_alert').show();");
                    script.Append("</script>");
                    ViewBag.StartScript = script.ToString();
                    return(View(articleVM));
                }
            }
            else
            {
                return(RedirectToAction("Authenticate", "Account"));
            }


            return(View(articleVM));
        }
        public static void Initialize(ToDoDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Items.Any())
            {
                return;
            }

            var cat1 = new Category {
                Name = "Cat1", Parent = null
            };
            var cat2 = new Category {
                Name = "Cat11", Parent = cat1
            };
            var cat3 = new Category {
                Name = "Cat12", Parent = cat1
            };

            var tag1 = new Tag {
                Name = "Tag1", Color = "Yellow"
            };
            var tag2 = new Tag {
                Name = "Tag2", Color = "Red"
            };

            var item1 = new Item {
                Title = "Item1", Description = "xxx", Priority = Priority.High, Category = cat1, DueDate = DateTime.Now, Status = false
            };
            var item2 = new Item {
                Title = "adult", Description = "Text", Priority = Priority.Low, Category = cat2, DueDate = DateTime.Now, Status = true
            };
            var item3 = new Item {
                Title = "Iasdxxxa", Description = "Text", Priority = Priority.Medium, Category = cat3, DueDate = DateTime.Now, Status = false
            };
            var item4 = new Item {
                Title = "Item4", Description = "Text", Priority = Priority.SuperLow, Category = cat3, DueDate = DateTime.Now, Status = false
            };

            var con1 = new TagItem {
                Item = item1, Tag = tag1
            };
            var con2 = new TagItem {
                Item = item1, Tag = tag2
            };
            var con3 = new TagItem {
                Item = item2, Tag = tag1
            };
            var con4 = new TagItem {
                Item = item2, Tag = tag2
            };

            context.Items.AddRange(item1, item2, item3, item3);
            context.Categories.AddRange(cat1, cat2, cat3);
            context.Tags.AddRange(tag1, tag2);
            context.TagsItems.AddRange(con1, con2, con3, con4);

            context.SaveChanges();
        }
 public EditTagWnd(TagItem item)
 {
     _tagItem = item;
     InitializeComponent();
     _tagItem.BeginEdit();
     DataContext = _tagItem;
     ServiceProvider.Settings.ApplyTheme(this);
 }
 public static string ToString(TagItem tag)
 {
     if (tag == null)
     {
         return("null");
     }
     return("{tag name: " + tag.tagName + ", tag type: " + tag.tagType + "}");
 }
        public Tag(TagItem item)
        {
            InitializeComponent();

            this.item = item;

            LoadTag();
        }
        private void btn_del_tag_Click(object sender, RoutedEventArgs e)
        {
            TagItem item = lst_tags.SelectedItem as TagItem;

            if (item != null)
            {
                Session.Tags.Remove(item);
            }
        }
        /// <summary>
        /// Remove a tag from a card
        /// </summary>
        /// <param name="tagName">name of tag to be removed</param>
        /// <param name="cardId">id of card from which to remove card</param>
        /// <returns></returns>
        public bool RemoveTagFromCard(string tagName, int cardId)
        {
            TagItem  tag  = GetTag(tagName);
            CardItem card = GetCard(cardId);

            card.Tags.Remove(tag);
            UpdateCard(card, cardId);
            return(true);
        }
Exemple #28
0
 protected override void WriteTag(TagItem tag, FlashWriter output)
 {
     if (tag.Kind == TagKind.DoABC)
     {
         DoABCTag doABCTag = (DoABCTag)tag;
         doABCTag.ABCData = _abcFileTags[doABCTag].ToArray();
     }
     base.WriteTag(tag, output);
 }
Exemple #29
0
        public static void RemoveTag(TagItem tagItem)
        {
            if (tagItem == null)
            {
                return;
            }

            StaticTagItems.Remove(tagItem);
        }
Exemple #30
0
        private void BtnOperate_Click(object sender, RoutedEventArgs e)
        {
            if (!_OpcClient.IsConnected)
            {
                Msg("请先连接服务器");
                return;
            }

            string serverId   = TbTagServerId.Text.Trim();
            string writeValue = LbWriteValue.Text.Trim();

            if (string.IsNullOrEmpty(serverId))
            {
                Msg("请输入Tag ServerID");
                TbTagServerId.Focus();
                return;
            }

            Button  btn     = sender as Button;
            TagItem tagItem = new TagItem()
            {
                ServerId     = serverId,
                ValueToWrite = writeValue,
                NameSpace    = "2",
                CallBack     = this.TagCallBack
            };

            switch (btn?.Tag?.ToString())
            {
            case "1":
                //同步读
                TagItem item = _OpcClient.Read(tagItem);
                LbReadValue.Content = item.Value;
                break;

            case "2":
                //异步读
                _OpcClient.AsyncRead(tagItem);
                break;

            case "3":
                //同步写
                _OpcClient.Write(tagItem);
                break;

            case "4":
                //异步写
                _OpcClient.AsyncWrite(tagItem);
                break;

            case "5":
                //添加订阅
                _OpcClient.AddSubscription(tagItem);
                break;
            }
        }
Exemple #31
0
        /// <summary>
        /// 检查更新
        /// </summary>
        /// <returns>没有更新时返回null,检查失败时返回的updateinfo.status=false</returns>
        public static UpdateInfo Check()
        {
            var info = new UpdateInfo();

            try
            {
                Logger.Info("Checking update info");
                var data = Http.Get(tagsUrl);
                if (data == null)
                {
                    return(info);
                }
                var list = Json.Deserialize <List <TagItem> >(data);

                // 需要找到大于当前版本的tag其中最大的一个
                TagItem tag            = null;
                var     currentVersion = Version.Parse(Application.ProductVersion);

                foreach (var item in list)
                {
                    if (tag == null)
                    {
                        if (currentVersion < Version.Parse(item.name))
                        {
                            tag = item;
                        }
                    }
                    else
                    {
                        if (Version.Parse(tag.name) < Version.Parse(item.name))
                        {
                            tag = item;
                        }
                    }
                }

                if (tag == null)
                {
                    Logger.Info("Newer tag not found");
                    return(null);
                }

                info.Status  = true;
                info.Version = tag.name;
                info.Link    = string.Format(downloadUrl, tag.commit.sha);

                LoadUpdateDetail(info);
                LoadFileInfo(info, tag.commit.sha);
                return(info);
            }
            catch (Exception ex)
            {
                Logger.Warn(ex);
                return(info);
            }
        }
        private void btn_edit_tag_Click(object sender, RoutedEventArgs e)
        {
            TagItem item = lst_tags.SelectedItem as TagItem;

            if (item != null)
            {
                var wnd = new EditTagWnd(item);
                wnd.ShowDialog();
            }
        }
Exemple #33
0
            public void Layout(Graphics g)
            {
                if (!_needUpdateTagLayout) return;

                _rectTags.Clear();

                int maxY = 2;
                if (_listItem.DenshaImage != null && _listItem.DenshaImage.Tags != null)
                {
                    int x = 2; int y = 2;

                    int maxWidth = _bounds.Width - 4;
                    foreach (Tag tag in _listItem.DenshaImage.Tags)
                    {
                        TagItem tagItem = new TagItem(tag, this);
                        Size size = tagItem.GetPreferredSize(g, maxWidth);
                        if (x + size.Width > maxWidth)
                        {
                            x = 2;
                            if (y < maxY)
                            {
                                y = maxY;
                            }
                        }
                        Rectangle rect = new Rectangle(x, y, size.Width, size.Height);
                        tagItem.Bounds = rect;
                        _rectTags.Add(new KeyValuePair<Tag, TagItem>(tag, tagItem));
                        x = rect.Right + 2;
                        if (rect.Bottom + 2 > maxY) maxY = rect.Bottom + 2;
                    }
                }
                if (_rectTags.Count > 0)
                {
                    _bounds.Height = maxY;
                }
                else
                {
                    _bounds.Height = 0;
                }

                _needUpdateTagLayout = false;
            }
        public void When(TagItem c)
        {
            TagId id;
            if (!_state.TryGetTag(c.Tag, out id))
            {
                id = _state.GetNext(g => new TagId(g));
                Apply(new TagCreated(c.Tag, id));
            }

            SimpleStory story;
            if (_state.TryGetStory(new StoryId(c.ItemId),out story))
            {
                if (!story.Tags.Contains(id))
                {
                    Apply(new TagAddedToStory(story.Id, id, c.Tag, story.Name));
                }
                return;
            }

            throw Error("Can't tag item '{0}'", c.ItemId);
        }
 /// <summary>タグIDを取得・ない場合は作成する。</summary>
 /// <param name="tag"></param>
 /// <returns></returns>
 public long getandWriteTagId(string tag)
 {
     //
     long result = 0;
     var taginfo = _db.Table<TagItem>().Where(m => m.TagStr == tag);
     foreach (TagItem tagitem in taginfo)
     {
         result = tagitem.TagId;
     }
     if (result == 0)
     {
         // タグ情報がない場合は作成
         TagItem tagitem = new TagItem
         {
             TagStr = tag
         };
         // 書き込むとIDが付与される
         _db.Insert(tagitem);
         result = tagitem.TagId;
     }
     return result;
 }
Exemple #36
0
        private bool SaveTag()
        {
            int rowcount = dataGridViewTag.Rows.Count;
            OfficePlate platenew = new OfficePlate();
            for (int i = 0; i < rowcount - 1; i++)
            {
                TagItem ti = new TagItem();
                object objdatafield = dataGridViewTag.Rows[i].Cells["ColumnDataField"].Value;
                if (objdatafield == null || objdatafield.ToString().Trim().Length == 0)
                {
                    MessageBox.Show("DataField can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
                ti.DataField = objdatafield.ToString();
                object objexpression = dataGridViewTag.Rows[i].Cells["ColumnExpression"].Value;
                if (objexpression == null || objexpression.ToString().Trim().Length == 0)
                {
                    MessageBox.Show("Expression can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
                ti.Exp = objexpression.ToString();
                object objformat = dataGridViewTag.Rows[i].Cells["ColumnFormat"].Value;
                if (objformat == null)
                {
                    objformat = string.Empty;
                }
                ti.Format = objformat.ToString();
                platenew.Tags.Add(ti);
            }

            IComponentChangeService ComponentChangeService =
               this.DesignerHost.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            object oldValue = null;
            object newValue = null;

            PropertyDescriptor desTags = TypeDescriptor.GetProperties(plate)["Tags"];
            ComponentChangeService.OnComponentChanging(this.plate, desTags);
            oldValue = plate.Tags;
            plate.Tags = platenew.Tags;
            newValue = plate.Tags;
            ComponentChangeService.OnComponentChanged(plate, desTags, oldValue, newValue);

            tabPageTag.Text = "Tag Defination";
            btnSaveTag.Enabled = false;
            btnUndoTag.Enabled = false;
            return true;
        }
 /// <summary>一覧(新しい順に)</summary>
 /// <param name="queryTags">絞り込む条件となるタグ・現時点で一つ対応</param>
 /// <returns></returns>
 public IEnumerable<ImageItem> GetItems(TagItem[] queryTags = null)
 {
     if (queryTags == null)
     {
         lock (Locker)
         {
             var result = _db.Table<ImageItem>().OrderByDescending(m => m.ImageId);
             return result;
         }
     }
     else
     {
         // クエリを指定
         //
         //
         List<ImageItem> result;
         lock (Locker)
         {
             result = _db.Query<ImageItem>("select i.ImageId, i.Path, DateModified from ImageItem as i INNER JOIN ImageTag as t on i.ImageId = t.ImageId where t.TagId = " + queryTags[0].TagId);
         }
         return result.ToArray();
     }
 }
Exemple #38
0
        static private bool HandleDocTagCompletion(ScintillaControl Sci)
        {
            if (ASContext.CommonSettings.JavadocTags == null || ASContext.CommonSettings.JavadocTags.Length == 0)
                return false;

            string txt = Sci.GetLine(Sci.CurrentLine).TrimStart();
            if (!Regex.IsMatch(txt, "^\\*[\\s]*\\@"))
                return false;
            
            // build tag list
            if (docVariables == null)
            {
                docVariables = new List<ICompletionListItem>();
                TagItem item;
                foreach (string tag in ASContext.CommonSettings.JavadocTags)
                {
                    item = new TagItem(tag);
                    docVariables.Add(item);
                }               
            }
            
            // show
            CompletionList.Show(docVariables, true, "");
            return true;
        }
Exemple #39
0
		private async Task LoadTopics()
		{
			var client = new System.Net.Http.HttpClient();
			var tags = new string[]{
									"Russia",
									"Demographics",
									"Energy",
									"Economics",
									"Africa",
									"Agriculture",
									"Commodity Passport",
									"World Data Maps"};

			var colors = new string[] { "#14674b", "#146714", "#671414", "#674b14", "#144b67", "#141467", "#4b1467", "#66144b" };
		
			foreach (var topic in tags)
			{
				var color = colors[tags.ToList().IndexOf(topic)];

				var group = new TagItem(topic, topic, string.Empty, "Assets/DarkGray.png", string.Empty, color);

				var tagResp = await client.GetAsync(string.Format("http://knoema.com/api/1.0/frontend/tags?tag={0}&count=20&client_id=EZj54KGFo3rzIvnLczrElvAitEyU28DGw9R73tif", topic));

				var resources = JsonConvert.DeserializeObject<IEnumerable<ResourceItem.Serial>>(await tagResp.Content.ReadAsStringAsync());
				foreach (var resource in resources.Where(res => res.Type != "Dataset"))
					group.Items.Add(new ResourceItem(resource, group, color));

				this.HomeTags.Add(group);
			}
		}
 public void AddTagIds(TagItem[] tagItems)
 {
     items = new List<TagItem>(tagItems);
 }
Exemple #41
0
        private void tagCreatedCallBack(TagCreatedResponseEArgs e)
        {
            if (e.tag != null)
            {
                TagItem tmpTag = TagItem.CreateTagItem(e.tag);
                tags.Add(tmpTag);
                TagAddAndSearch = tmpTag;
                foreach (ResourceItem resc in selectedResources)
                {
                    if (RelationCreated != null)
                    {
                        RelationCreated(e.tag,resc.Resource, RelationCreatedCallBack);
                    }

                }
            }
        }
		public void RemoveTag(TagItem tagItem)
		{
			Items.Remove(tagItem);
		}
		static private bool HandleDocTagCompletion(ScintillaNet.ScintillaControl Sci)
		{
			string txt = Sci.GetLine(Sci.LineFromPosition(Sci.CurrentPos)).TrimStart();
			if (!Regex.IsMatch(txt, "^\\*[\\s]*\\@"))
				return false;
			DebugConsole.Trace("Documentation tag completion");
			
			// build tag list
			if (docVariables == null)
			{
				docVariables = new ArrayList();
				TagItem item;
				string[] tags = ASContext.DocumentationTags.Split(' ');
				foreach(string tag in tags)
				{
					item = new TagItem(tag);
					docVariables.Add(item);
				}				
			}
			
			// show
			CompletionList.Show(docVariables, true, "");
			return true;
		}
        private void viewImgGrid(string inputTag = null)
        {
            ContentResolver cr = ContentResolver;
            List<ImageItem> dbImageItems = new List<ImageItem>();
            GridView gridview = null;
            try
            {
                gridview = FindViewById<GridView>(Resource.Id.gridview);
            }
            catch
            {
                Console.WriteLine("GridViewの取得に失敗しました");
            }
            var adp = new ImageAdapter(this, cr);

            // DBのテスト

            /*ImageItem tempItem = new ImageItem()
            {
                ImageId = DateTime.Now.Millisecond,
                Path = "temp" + DateTime.Now.Millisecond.ToString(),
                DateModified = DateTime.Now
            };*/
            //_db.SaveItem(tempItem); 
            //string st = "";
            try
            {
                TagItem[] temp;
                if (inputTag != null)
                {
                    temp = new TagItem[1];
                    temp[0] = new TagItem { TagId = _db.getandWriteTagId(inputTag) };
                }
                else {
                    temp = null;
                }
                var ItemsSource = _db.GetItems(temp);
                //var ItemsSource = _db.GetItemList();
                foreach (ImageItem i in ItemsSource)
                {
                    dbImageItems.Add(i);
                    //st += i.Path + " ";
                }
                //tagEditBox.Text = st;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            adp.AddImageIds(dbImageItems);
            gridview.Adapter = adp;

            DateTime lastUpdatedlocal = DateTime.Now;
            lastUpdated = lastUpdatedlocal;
            gridview.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args)
            {
                if (lastUpdated == lastUpdatedlocal)
                {
                    using (var intent = new Intent(this, typeof(SingleImageActivity)))
                    {
                        int position = args.Position;
                        ImageItemforUI intentData = new ImageItemforUI(dbImageItems[position]);
                        //Toast.MakeText(this, dbImageItems[position].Path, ToastLength.Short).Show();

                        intent.PutExtra("data", intentData);
                        StartActivity(intent);
                    }
                }else
                {
                    Console.WriteLine("過去に作成されたイベントが呼ばれました。");
                }
                //StartActivityForResult(intent,0);
            };
        }