Пример #1
0
        private void RfidManager_ListTags(object sender, ListTagsEventArgs e)
        {
            // 标签总数显示
            if (e.Result.Results != null)
            {
                TagList.Refresh(sender as BaseChannel <IRfid>,
                                e.ReaderNameList,
                                e.Result.Results,
                                (add_books, update_books, remove_books, add_patrons, update_patrons, remove_patrons) =>
                {
                    TagChanged?.Invoke(sender, new TagChangedEventArgs
                    {
                        AddBooks      = add_books,
                        UpdateBooks   = update_books,
                        RemoveBooks   = remove_books,
                        AddPatrons    = add_patrons,
                        UpdatePatrons = update_patrons,
                        RemovePatrons = remove_patrons
                    });
                },
                                (type, text) =>
                {
                    RfidManager.TriggerSetError(this, new SetErrorEventArgs {
                        Error = text
                    });
                    // TagSetError?.Invoke(this, new SetErrorEventArgs { Error = text });
                });

                // 标签总数显示 图书+读者卡
                // this.Number = $"{TagList.Books.Count}:{TagList.Patrons.Count}";
            }
        }
Пример #2
0
 private void CbxTags_SelectionChanged(object sender, EventArgs e)
 {
     if (TagChanged != null)
     {
         TagChanged.Invoke(this, EventArgs.Empty);
     }
 }
Пример #3
0
        private void DeleteTag(object sender, MouseButtonEventArgs e)
        {
            StackPanel sp      = (sender as FrameworkElement).Parent as StackPanel;
            TextBox    textBox = sp.Children.OfType <TextBox>().First();
            var        tl      = TagList.Where(arg => arg == textBox.Text).ToList();

            foreach (var item in tl)
            {
                TagList.Remove(item);
            }
            TagChanged?.Invoke(this, new ListChangedEventArgs(TagList));
            Refresh();
        }
Пример #4
0
        private void SaveTag(object sender, RoutedEventArgs e)
        {
            //获得所有 Text;
            List <string> tags = new List <string>();

            for (int i = 0; i < itemsControl.Items.Count; i++)
            {
                ContentPresenter c         = (ContentPresenter)itemsControl.ItemContainerGenerator.ContainerFromItem(itemsControl.Items[i]);
                WrapPanel        wrapPanel = FindElementByName <WrapPanel>(c, "TagWrapPanel");
                if (wrapPanel != null)
                {
                    TextBox tb  = LogicalTreeHelper.FindLogicalNode(wrapPanel, "tb") as TextBox;
                    string  tag = tb.Text.Replace(";", "").Replace(";", "");
                    if (!tags.Contains(tag))
                    {
                        tags.Add(tag);
                    }
                }
            }
            TagChanged?.Invoke(this, new ListChangedEventArgs(tags));
        }
Пример #5
0
        /// <summary>
        /// Event invoker for <see cref="TagChanged"/> event.
        /// </summary>
        /// <param name="args">Event arguments.</param>
        protected virtual void OnTagChanged(EventArgs args)
        {
            Debug.Assert(args != null);

            TagChanged?.Invoke(this, args);
        }
Пример #6
0
        /// <summary>
        /// Event invoker for <see cref="TagChanged"/> event.
        /// </summary>
        /// <param name="args">Event arguments.</param>
        private void OnTagChanged([NotNull] EventArgs args)
        {
            Debug.Assert(args != null);

            TagChanged?.Invoke(this, args);
        }
Пример #7
0
        private void _opcManager_DataChanged(object sender, Objects.OpcItemEventArgs e)
        {
            Tag t = Module1.TagList.Select(x => x).Where(x => x.Handle == e.ItemHandle).FirstOrDefault();

            TagChanged?.Invoke(t);
            switch (t.FormId)
            {
            case 1:
                AssignValueToControl(this, "Z" + e.ItemHandle, null, e.ItemValue);
                AssignValueToControl(_frmConfig, "Z" + e.ItemHandle, null, e.ItemValue);
                break;

            case 2:
                break;

            case 3:
                break;

            case 4:
                break;

            case 5:
                break;

            case 6:
                AssignValueToControl(_frmConfig, "Z" + e.ItemHandle, null, e.ItemValue);
                //AssignValueToControl(_frmConfig, "Z" + e.ItemHandle, "Enabled", !(bool)e.ItemValue);

                //if (e.ItemValue.GetType() == typeof(bool))
                //{
                //    AssignValueToControl(_frmConfig, "Z" + e.ItemHandle, "ImageIndex", (bool)e.ItemValue ? 1 : 0);
                //    AssignValueToControl(_frmConfig, "Z" + e.ItemHandle, "Enabled", !(bool)e.ItemValue);
                //}
                //else
                //{
                //    AssignValueToControl(_frmConfig, "Z" + e.ItemHandle, null, e.ItemValue);
                //}
                break;

            case 7:
                AssignValueToControl(_frmEthernet, "B" + e.ItemHandle, "BackColor", (bool)e.ItemValue ? Color.Green : Color.Red);
                break;

            case 8:
                break;

            case 9:
                break;

            case 10:
                break;

            case 12:     //11
                switch (e.ItemHandle)
                {
                case 34:
                    AssignValueToControl(_frmHome, "B33", "ImageIndex", 2);
                    break;

                case 1:
                    AssignValueToControl(_frmHome, "B33", "ImageIndex", 0);
                    break;

                case 119:
                    AssignValueToControl(_frmHome, "B117", "ImageIndex", 2);
                    break;

                case 126:
                    AssignValueToControl(_frmHome, "B117", "ImageIndex", 0);
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
            if (e.IsFault)
            {
                button16.BackColor = Color.Red;
                string   tag  = (string)Module1.TagList[e.ItemHandle].Name;
                DateTime date = DateTime.Now;
                DbManager.Insert("faults", "0,'" + tag + "','" + date.ToString("yyyy-MM-dd hh:mm") + "',1,(SELECT h FROM (SELECT corr as h FROM tags WHERE handle=" + e.ItemHandle + ") AS G)");
            }
        }
Пример #8
0
 public void InvokeTagChanged(object sender, ModelChangedEventArgs <Tag> arg)
 {
     TagChanged?.Invoke(sender, arg);
 }
Пример #9
0
 /* ----------------------------------------------------------------- */
 ///
 /// OnTagChanged
 ///
 /// <summary>
 /// TagChanged イベントを発生させます。
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 protected virtual void OnTagChanged(ValueChangedEventArgs <Tag> e)
 => TagChanged?.Invoke(this, e);