protected override void WriteElementExtensions(XmlWriter writer, string version) { WriteItunesElement(writer, "subtitle", Subtitle); WriteItunesElement(writer, "author", Author); WriteItunesElement(writer, "summary", Summary); if (ImageUrl != null) { WriteItunesElement(writer, "image", ImageUrl.ToString()); } WriteItunesElement(writer, "explicit", Explicit ? "yes" : "no"); writer.WriteStartElement(prefix, "owner", @namespace); WriteItunesElement(writer, "name", OwnerName); WriteItunesElement(writer, "email", OwnerEmail); writer.WriteEndElement(); foreach (var category in ItunesCategories) { writer.WriteStartElement(prefix, "category", @namespace); writer.WriteAttributeString("text", category[0]); if (category.Count == 2) { writer.WriteStartElement(prefix, "category", @namespace); writer.WriteAttributeString("text", category[1]); writer.WriteEndElement(); } writer.WriteEndElement(); } }
protected override void WriteElementExtensions(XmlWriter writer, string version) { WriteItunesElement(writer, "subtitle", Subtitle); WriteItunesElement(writer, "author", Author); WriteItunesElement(writer, "summary", Summary); if (ImageUrl != null) { WriteItunesElement(writer, "image", ImageUrl.ToString()); } WriteItunesElement(writer, "explicit", Explicit ? "yes" : "no"); writer.WriteStartElement(_prefix, "owner", _namespace); WriteItunesElement(writer, "name", OwnerName); WriteItunesElement(writer, "email", OwnerEmail); writer.WriteEndElement(); }
public async Task Save() { string _Result = "OK"; IsWorking = true; if (!string.IsNullOrEmpty(ImageUrl.ToString())) { if (!ImageUrl.ToString().Contains(RuntimeSettings.ImagePlaceholderName)) { if (!ImageUrl.ToString().Contains("Uri")) { try { string imgPath = ImageUrl.ToString().Split(':')[1].Trim(); _Result = await _this.Edit(imgPath); } catch (Exception ex) { _Result = ex.Message; } } } } if (_Result == "OK") { _Result = await ProcessAttachmentsVm.Save(partId : _this.PartId); IsWorking = false; if (_Result == "OK") { IsWorking = false; await Application.Current.MainPage.DisplayAlert("Zapisano", "Zapis zakończony powodzeniem!", "OK"); } else { IsWorking = false; await Application.Current.MainPage.DisplayAlert("Błąd zapisu", $"Zapis załączników zakończony błędem: {_Result}", "OK"); } } else { IsWorking = false; await Application.Current.MainPage.DisplayAlert("Błąd zapisu", $"Zapis danych części zakończony błędem: {_Result}", "OK"); } }
public override bool Prepare(Vector3I[] marks) { // Check the given marks if (marks == null) { throw new ArgumentNullException("marks"); } if (marks.Length != 2) { throw new ArgumentException("DrawImage: Exactly 2 marks needed.", "marks"); } // Make sure that a direction was given Vector3I delta = marks[1] - marks[0]; if (Math.Abs(delta.X) == Math.Abs(delta.Y)) { throw new ArgumentException( "DrawImage: Second mark must specify a definite direction " + "(north, east, south, or west) from first mark.", "marks"); } Marks = marks; // Download the image if (ImageBitmap == null) { ImageBitmap = WorldCommands.DownloadImage(ImageUrl.ToString(), Player); if (ImageBitmap == null) { throw new Exception("Error downloading image"); } } Vector3I endCoordOffset = CalculateCoordConversion(delta); // Calculate maximum bounds, and warn if we're pushing out of the map BoundingBox fullBounds = new BoundingBox(Marks[0], Marks[0] + endCoordOffset); if (fullBounds.XMin < 0 || fullBounds.XMax > Map.Width - 1) { Player.Message("&WDrawImage: Not enough room horizontally (X), image cut off."); } if (fullBounds.YMin < 0 || fullBounds.YMax > Map.Length - 1) { Player.Message("&WDrawImage: Not enough room horizontally (Y), image cut off."); } if (fullBounds.ZMin < 0 || fullBounds.ZMax > Map.Height - 1) { Player.Message("&WDrawImage: Not enough room vertically, image cut off."); } // clip bounds to world boundaries Bounds = Map.Bounds.GetIntersection(fullBounds); BlocksTotalEstimate = Bounds.Volume; // set starting coordinate imageX = minX; imageY = minY; layer = 0; Brush = this; return(true); }
public void Dispose_CHECK_REFERENCE_COUNT_WHEN_IMAGEURL_CLASS() { /* TEST CODE */ path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; Stream stream = File.OpenRead(path); EncodedImageBuffer buffer = new EncodedImageBuffer(stream); imageUrl = buffer.GenerateUrl(); //check imagUrl var expectedValue = RefCountWhenNew; Assert.AreEqual(expectedValue, imageUrl.RefCnt(), $"reference count should be {expectedValue}"); View testView = new View { Name = "testImageUrl", Size = new Size(testSize, testSize, 0), Position = new Position(testPosition, testPosition, 0), BackgroundImage = imageUrl.ToString(), }; // new EventThreadCallback( new EventThreadCallback.CallbackDelegate // ( // ()=> // { // NUIApplication.GetDefaultWindow().Add(testView); // } // ) // ).Trigger(); // test1(testView); // await Task.Delay(300); //check imagUrl expectedValue = RefCountWhenNew; Assert.AreEqual(expectedValue, imageUrl.RefCnt(), $"reference count should be {expectedValue}"); NUIApplication.GetDefaultWindow().Add(testView); //await Task.Delay(300); //check imagUrl expectedValue = RefCountWhenNew; Assert.AreEqual(expectedValue, imageUrl.RefCnt(), $"reference count should be {expectedValue}"); //imageUrl.Dispose(); //check testView expectedValue = RefCountWhenNew + RefCountWhenAdd; Assert.AreEqual(expectedValue, testView.RefCnt(), $"reference count should be {expectedValue}"); View sameImageUrlView = new View { Name = "testImageUrl2", Size = new Size(testSize, testSize, 0), Position = new Position(testPosition * 2, testPosition * 2, 0), BackgroundImage = imageUrl.ToString(), }; //check imagUrl expectedValue = RefCountWhenNew; Assert.AreEqual(expectedValue, imageUrl.RefCnt(), $"reference count should be {expectedValue}"); NUIApplication.GetDefaultWindow().Add(sameImageUrlView); //check imagUrl expectedValue = RefCountWhenNew; Assert.AreEqual(expectedValue, imageUrl.RefCnt(), $"reference count should be {expectedValue}"); }