コード例 #1
0
 public Multimedia(string title, int order, string url, MultimediaType type)
 {
     this.title = title;
     this.order = order;
     this.url   = url;
     this.type  = type;
 }
コード例 #2
0
 public MultimediaDevice(SerializationInfo info, StreamingContext context)
 {
     this.mType              = (MultimediaType)info.GetValue("mType", typeof(MultimediaType));
     this.model              = (string)info.GetValue("model", typeof(string));
     this.brightness         = (int)info.GetValue("brightness", typeof(int));
     this.suportedScreenSize = (int)info.GetValue("suportedScreenSize", typeof(int));
 }
コード例 #3
0
        private void AddToList(TextBox tb1, TextBox tb2, TextBox tb3, TextBox tb4, TextBox tb5,
                               RadioButton rb1, RadioButton rb2, RadioButton rb3,
                               Adds a1, Adds a2, Adds a3, MultimediaType multiType)
        {
            if (AreTextFieldsFilled(tb1.Text, tb2.Text, tb3.Text, tb4.Text, tb5.Text))
            {
                Adds add = CheckAdditionalFeatures(rb1, rb2, rb3, a1, a2, a3);

                try
                {
                    switch (multiType)
                    {
                    case MultimediaType.Movie: ItemList.Add(new MovieDVD(tb1.Text, tb2.Text, int.Parse(tb3.Text), tb4.Text, double.Parse(tb5.Text), add)); break;

                    case MultimediaType.Music: ItemList.Add(new MusicCD(tb1.Text, tb2.Text, int.Parse(tb3.Text), tb4.Text, double.Parse(tb5.Text), add)); break;

                    case MultimediaType.Game: ItemList.Add(new GameCD(tb1.Text, tb2.Text, int.Parse(tb3.Text), tb4.Text, double.Parse(tb5.Text), add)); break;
                    }
                }
                catch (FormatException fe)
                {
                    MessageBox.Show(@"Type 'Release Year' and 'Price' in the format of Integer or Double", "Number Format Warning");
                    Console.Write(fe.Message);
                }
            }
        }
コード例 #4
0
 private bool isMultimediaAvailable(MultimediaType multimediaType)
 {
     if (this.ListMultimedia != null)
     {
         if (this.ListMultimedia.Where(m => m.MType == multimediaType).FirstOrDefault() != null)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #5
0
        public static string GetRandomContentType(MultimediaType multimediaType)
        {
            if (multimediaType == MultimediaType.Text)
            {
                return(GetRandomTextContentType());
            }

            if (multimediaType == MultimediaType.Video)
            {
                return(GetRandomVideoContentType());
            }

            return(string.Empty);
        }
コード例 #6
0
 private static string MediaTypeToString(MultimediaType type)
 {
     switch (type)
     {
         case MultimediaType.Image:
             return "photograph";                    
         case MultimediaType.Video:
             return "video";                    
         case MultimediaType.Audio:
             return "audio";
         default:
             throw new NotImplementedException("Forgotten case");       
     }
 }
 public CompletedEnglishMultimedia(
     string id,
     Guid userId,
     string contentId,
     string englishLevel,
     DateTime date,
     string tittle,
     string contentType,
     MultimediaType multimediaType)
     : base(id, userId, contentId, englishLevel, date)
 {
     Tittle         = tittle;
     ContentType    = contentType;
     MultimediaType = multimediaType;
 }
コード例 #8
0
        private void ProcessRichTextXlink(XmlElement xlinkElement, BuildProperties buildProperties)
        {
            const string xlinkNamespaceUri = "http://www.w3.org/1999/xlink";

            string xlinkHref = xlinkElement.GetAttribute("href", xlinkNamespaceUri);

            if (string.IsNullOrEmpty(xlinkHref))
            {
                log.Warning("No xlink:href found: " + xlinkElement.OuterXml);
                return;
            }

            Component component = engine.GetObject(xlinkHref) as Component;

            if (component == null || component.BinaryContent == null)
            {
                // XLink doesn't refer to MM Component; do nothing.
                return;
            }
            log.Debug("Processing XLink to Multimedia Component: " + component.Id);

            BinaryContent  binaryContent  = component.BinaryContent;
            MultimediaType multimediaType = binaryContent.MultimediaType;

            string url;

            if (multimediaType.MimeType == EclMimeType && buildProperties.ECLEnabled)
            {
                using (EclProcessor eclProcessor = new EclProcessor(engine, binaryPathProvider.GetTargetStructureGroupUri(component.Id)))
                {
                    url = eclProcessor.ProcessEclXlink(xlinkElement);
                }
            }
            else
            {
                url = PublishMultimediaComponent(component.Id, buildProperties);
            }

            // Put the resolved URL (path) in an appropriate XHTML attribute
            string attrName = (xlinkElement.LocalName == "img") ? "src" : "href"; // Note that XHTML is case-sensitive, so case-sensitive comparison is OK.

            xlinkElement.SetAttribute(attrName, url);

            // NOTE: intentionally not removing xlink:href attribute to keep the MM Component ID available for post-processing purposes (e.g. DXA).

            log.Debug(string.Format("XLink to Multimedia Component '{0}' resolved to: {1}", component.Id, xlinkElement.OuterXml));
        }
コード例 #9
0
ファイル: BotApi.cs プロジェクト: tchusami/TelegramBotsDotNet
        /// <summary>
        /// Use this method to send multimedia files. On success, the sent Message is returned.
        /// </summary>
        /// <param name="chat_id">Unique identifier for the message recipient — User or GroupChat id.</param>
        /// <param name="file_path">File to send. You can upload a new file using multipart/form-data.</param>
        /// <param name="type">Type of file to send.</param>
        /// <param name="reply_markup">Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.</param>
        /// <param name="caption">Photo caption (only use with Type.Photo).</param>
        /// <param name="reply_to_message_id">If the message is a reply, ID of the original message.</param>
        /// <returns></returns>
        public Message SendMultimedia(int chat_id, string file_path, MultimediaType type, ReplyKeyboardHide reply_markup, string caption = null, int reply_to_message_id = -1)
        {
            string url = BaseUrl + "send" + type.ToString();

            byte[] file = null;
            using (var content = new MultipartFormDataContent("-------BotAPIDotNET"))
            {
                content.Add(new StringContent(string.Format("{0}", chat_id)), "chat_id");
                var fileStream = File.Open(file_path, FileMode.Open, FileAccess.Read);
                content.Add(new StreamContent(fileStream), type.ToString().ToLower(), file_path.Replace("\\", "/").Split('/').LastOrDefault());
                if (!string.IsNullOrEmpty(caption) && type == MultimediaType.Photo)
                    content.Add(new StringContent(caption), "caption");
                if (reply_to_message_id != -1)
                    content.Add(new StringContent(string.Format("{0}", reply_to_message_id)), "reply_to_message_id");
                if (reply_markup != null)
                    content.Add(new StringContent(JsonConvert.SerializeObject(reply_markup, Formatting.None)), "reply_markup");

                Stream multipart = content.ReadAsStreamAsync().Result;
                file = new byte[multipart.Length];
                multipart.Seek(0, SeekOrigin.Begin);
                multipart.Read(file, 0, (int)multipart.Length);
            }

            var request = (HttpWebRequest)WebRequest.Create(url);
            request.ContentType = "multipart/form-data; boundary=\"-------BotAPIDotNET\"";
            request.Method = "POST";

            using (Stream writer = request.GetRequestStream())
            {
                writer.Write(file, 0, file.Length);
            }

            var response = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            return ParseResponseMessage(responseString);
        }
コード例 #10
0
ファイル: BotApi.cs プロジェクト: tchusami/TelegramBotsDotNet
        /// <summary>
        /// Use this method to send multimedia files. On success, the sent Message is returned.
        /// </summary>
        /// <param name="chat_id">Unique identifier for the message recipient — User or GroupChat id.</param>
        /// <param name="photo_id">File to send. You can pass a file_id as String to resend a photo that is already on the Telegram servers.</param>
        /// <param name="type">Type of file to send.</param>
        /// <param name="reply_markup">Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.</param>
        /// <param name="caption">Photo caption (only use with Type.Photo).</param>
        /// <param name="reply_to_message_id">If the message is a reply, ID of the original message.</param>
        /// <returns></returns>
        public Message ResendMultimedia(int chat_id, string photo_id, MultimediaType type, ForceReply reply_markup, string caption = null, int reply_to_message_id = -1)
        {
            string url = BaseUrl + "send" + type.ToString() + "?chat_id=" + chat_id + "&" + type.ToString().ToLower() + "=" + photo_id;
            if (!string.IsNullOrEmpty(caption) && type == MultimediaType.Photo)
                url += "&caption=" + caption;
            if (reply_to_message_id != -1)
                url += "&reply_to_message_id=" + reply_to_message_id;
            if (reply_markup != null)
                url += "&reply_markup=" + JsonConvert.SerializeObject(reply_markup, Formatting.None);

            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";

            var response = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            return ParseResponseMessage(responseString);
        }
コード例 #11
0
        public async Task <MultimediaType> Add(MultimediaType item)
        {
            var newItem = await _dbContext.MultimediaTypes.AddAsync(item);

            return(newItem.Entity);
        }
コード例 #12
0
 public Request(DateTime beginTime, int durationMin, RoomType roomType, RentPriceRangeType rentPriceRange, CapacityRangeType capacityRange, MultimediaType multimediaType,
                int roomTypePriority = 1, int rentPriceRangePriority = 1, int capacityRangePriority = 1, int multimediaTypePriority = 1)
 {
     this.Occupation             = new Timeslot(beginTime, durationMin);
     this.RoomTypeProp           = roomType;
     this.RentPriceRangeTypeProp = rentPriceRange;
     this.CapacityRange          = capacityRange;
     this.MultimediaTypeProp     = multimediaType;
     this.RoomTypePriority       = roomTypePriority;
     this.RentPriceRangePriority = rentPriceRangePriority;
     this.CapacityRangePriority  = capacityRangePriority;
     this.MultimediaTypePriority = multimediaTypePriority;
 }
コード例 #13
0
 private void MultimediaBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     MMDType = ClassGeneral.GetEnumByName <MultimediaType>(((ComboBoxItem)MultimediaBox.SelectedItem).Tag.ToString());
     ClearListView();
 }