Пример #1
0
 /// <summary>
 /// Initializes '_proxy', fills the listbox.
 /// </summary>
 /// <param name="tmp">Host.</param>
 /// <param name="userId">Id of user.</param>
 /// <param name="itemsId">Id of item.</param>
 /// <param name="data">Items type.</param>
 public WordsPrintFilter(EngServRef.EngServiceClient tmp, int userId, int itemsId, EngServRef.ServerData data) : this()
 {
     _proxy = tmp;
     user   = userId;
     item   = itemsId;
     type   = data;
 }
Пример #2
0
 /// <summary>
 /// Add a categoty to template.
 /// </summary>
 /// <param name="item">Id of category.</param>
 /// <param name="exp">The element in which an item is supposed to appear.</param>
 /// <param name="type">Categories type.</param>
 /// <param name="innerData">Type of related elements.</param>
 /// <param name="delete">'Delete' action.</param>
 /// <param name="edit">'Edit' action.</param>
 private void AddCategoryItem(int item, Expander exp, EngServRef.ServerData type, EngServRef.ServerData innerData, RoutedEventHandler delete, RoutedEventHandler edit)
 {
     Task.Run(() =>
     {
         Dispatcher.Invoke(() =>
         {
             StackPanel st = new StackPanel {
                 HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch
             };
             AddExpanderData($"{innerData}s", item, st, type, innerData);
             AddButtons(item, st, delete, edit, null);
             if (type == EngServRef.ServerData.Group && _proxy.GetItemData(item, EngServRef.ServerData.Group, EngServRef.ServerData.Word)?.Length > 0)
             {
                 Button btn = new Button {
                     Style = TryFindResource("MetroCircleButtonStyle") as Style, Content = new Image {
                         Source = new BitmapImage(new Uri("pack://application:,,,/Images/PlayGame.png")), Height = 15
                     }, Margin = new Thickness(5), Width = 37, Height = 35, HorizontalAlignment = HorizontalAlignment.Left, Background = Brushes.WhiteSmoke, Tag = item, ToolTip = "Play"
                 };
                 btn.Click += PlayWordsGroupGame_Click;
                 st.Children.Add(btn);
             }
             exp.Content = st;
         });
     });
 }
Пример #3
0
        /// <summary>
        /// Initializes '_proxy' and sets default rating.
        /// </summary>
        /// <param name="tmp">Host to be initialized.</param>
        /// <param name="id">Id of item.</param>
        /// <param name="userId">Id of user.</param>
        /// <param name="stars">The number of stars.</param>
        /// <param name="data">Type of item.</param>
        public EditRating(EngServRef.EngServiceClient tmp, int id, int userId, int?stars, EngServRef.ServerData data) : this()
        {
            _proxy = tmp;

            this.id = id;
            user    = userId;
            count   = stars == null? 0: Convert.ToInt32(stars);
            mark    = count;
            type    = data;

            foreach (Image item in wrRating.Children)
            {
                item.ToolTip = count;
                item.Opacity = (count >= Convert.ToInt32(item.Tag)) ? 1 : 0.2;
            }
        }
Пример #4
0
        //Edit rating of book or video.
        private void btnEditRating_Click(object sender, RoutedEventArgs e)
        {
            string[] keys = (sender as Button).Tag.ToString().Split(':');
            EngServRef.ServerData type = keys[0] == "Book"? EngServRef.ServerData.Book : EngServRef.ServerData.Video;
            EditRating            book = new EditRating(_proxy, Convert.ToInt32(keys[1]), Convert.ToInt32(keys[2]), Convert.ToInt32(keys[3]), type);

            book.ShowDialog();

            switch (type)
            {
            case EngServRef.ServerData.Video:
                btnVideos_Click(null, null);
                break;

            case EngServRef.ServerData.Book:
                btnBooks_Click(null, null);
                break;
            }
        }
Пример #5
0
 /// <summary>
 /// Add a word for video or book.
 /// </summary>
 /// <param name="tmp">Host.</param>
 /// <param name="wordsName">Word.</param>
 /// <param name="userId">Id of user.</param>
 /// <param name="itemId">Items id.</param>
 /// <param name="type">Items type.</param>
 public AddWord(EngServRef.EngServiceClient tmp, string wordsName, int?userId, int?itemId, EngServRef.ServerData type) : this(tmp, userId)
 {
     name = wordsName;
     item = itemId;
     data = type;
 }
Пример #6
0
 /// <summary>
 /// 'Edit' form. Hides rating, fills fields.
 /// </summary>
 /// <param name="tmp">Host.</param>
 /// <param name="id">Video id.</param>
 public AddVideo(EngServRef.EngServiceClient tmp, int id, EngServRef.ServerData type) : this()
 {
     _proxy = tmp;
     video  = id;
 }