How to Update Handle Current Album Image?
lib: https://github.com/martijn00/XamarinMediaManager
var webImage = new Image { Source = ImageSource.FromUri(new Uri("https://secure.meetupstatic.com/photos/event/4/7/b/8/600_455178360.jpeg")) };
CrossMediaManager.Current.Queue.Current.Title = "Changed Title";
CrossMediaManager.Current.Queue.Current.Artist= "Changed Artist";
CrossMediaManager.Current.Queue.Current.AlbumImage = webImage;
CrossMediaManager.Current.Queue.Current.AlbumImageUri = "https://secure.meetupstatic.com/photos/event/4/7/b/8/600_455178360.jpeg";
CrossMediaManager.Current.Queue.Current.DisplayImage = webImage;
CrossMediaManager.Current.Queue.Current.DisplayImageUri = "https://secure.meetupstatic.com/photos/event/4/7/b/8/600_455178360.jpeg";
CrossMediaManager.Current.Queue.Current.Image = webImage;
CrossMediaManager.Current.Queue.Current.ImageUri = "https://secure.meetupstatic.com/photos/event/4/7/b/8/600_455178360.jpeg";
CrossMediaManager.Current.Notification.UpdateNotification();
Console.WriteLine("Changed");
There is no image in Android:
http://prntscr.com/qvlln8
Plugin.MediaManager: 0.9.6
Related
I'm trying to create a payment method in my api using Mercado Pago, but I keep getting "Status code: 400 | API message: marketplace is required" on the catch (MercadoPago.Error.MercadoPagoApiException ex) part
public async Task AdvancedPayment()
{
try
{
MercadoPagoConfig.AccessToken = "{{AccessToken}}";
var token = "{{token}}";
var payer = new AdvancedPaymentPayerRequest
{
Email = "{{email}}",
Identification = new IdentificationRequest
{
Type = "CPF",
Number = "{{cpf}}"
}
};
var payment = new AdvancedPaymentSplitPaymentRequest
{
TransactionAmount = 1100,
Token = token,
Description = "Payment description",
Installments = 1,
PaymentMethodId = "master",
PaymentTypeId = "credit_card",
ExternalReference = "123456",
DateOfExpiration = DateTime.UtcNow.Add(TimeSpan.FromDays(120)),
ProcessingMode = "aggregator",
MerchantAccountId = "{{accountid}}",
};
var arpia = new AdvancedPaymentDisbursementRequest
{
Amount = 550,
ExternalReference = "Seller1" + Guid.NewGuid().ToString(),
CollectorId = {{CollectorId}},
ApplicationFee = 540,
};
var marketing = new AdvancedPaymentDisbursementRequest
{
Amount = 550,
ExternalReference = "Seller2" + Guid.NewGuid().ToString(),
CollectorId = {{CollectorId}},
ApplicationFee = 530,
};
var vendedor = new AdvancedPaymentDisbursementRequest
{
Amount = 550,
ExternalReference = "Seller3" + Guid.NewGuid().ToString(),
CollectorId = {{CollectorId}},
ApplicationFee = 530,
};
var disbursements = new List<AdvancedPaymentDisbursementRequest>()
{
arpia,
marketing
};
var payments = new List<AdvancedPaymentSplitPaymentRequest>()
{
payment
};
var advancedPaymentCreateRequest = new AdvancedPaymentCreateRequest
{
Payments = payments,
Disbursements = disbursements,
Payer = payer,
ApplicationId = "{{ApplicationId}}",
ExternalReference = "123456",
};
var advancedClient = new AdvancedPaymentClient();
var paymentResult = await advancedClient.CreateAsync(advancedPaymentCreateRequest);
}
catch (MercadoPago.Error.MercadoPagoApiException ex)
{
ex.Call.Request.Url.ToString(), error);
throw new Exception("ASDAS 2222", ex);
}
}
I have mischaracterized my data so I dont expose it, but the sdk does not complain about them.
Also, I realised that the marketplace attribute is inside the AdvancedPayment class, but the AdvancedPaymentClient.CreateAsync expects a AdvancedPaymentCreateRequest that does not have the marketplace attribute.
I can't use the normal PaymentClient.CreateAsync with the PaymentCreateRequest because I need to split the payment (AdvancedPaymentDisbursementRequest part) and I will not be able to set this.
I am hard coding the attributes for test, in the future they will be requested by the api.
The question is, how will I be able to pass this MarketPlace attribute if I can't insert it in the class that the method uses? And if that class don't have the MarketPlace, why the method that uses it, complains about that same attribute?
I have connect my phone to my localhost(xampp) but i fail to save the picture take by xamarin plugin to my pc directory. Below is my code:
public MainPage()
{
InitializeComponent();
//CameraButton.Clicked += CameraButton_Clicked;
var request = new HttpRequestMessage();
request.RequestUri = new Uri("http://192.168.137.1/pic/");
request.Method = HttpMethod.Post;
request.Headers.Add("Accept", "application/json");
//var client = new HttpClient();
//HttpResponseMessage response = client.SendAsync(request);
}
Below is save photo code:
var file = CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Rear,
CompressionQuality = 92,
SaveToAlbum = false,
Directory= "http://192.168.137.1/pic/",
Name = DateTime.Now + "_test.jpg"
});
Can anyone share me idea how to make it done? Please help and thanks.
Our asp.net application uses EXT.NET.
When a "View" menu is clicked, an EXT.NET window shows up with a content of a PDF file.
The problem is we can't drag and drop that window to a body of an Outlook email (to make it as the email attachment).
I am thinking one of the way to drag and drop to a body of an Outlook email is to show the PDF file in the browser window, not an EXT.NET window. How can I do that ?
Thank you.
This is from the View (Index.cshtml):
#{
ViewBag.Title = "Archive";
var X = Html.X();
}
#section SPAViews {
#(
X.Viewport().Layout(LayoutType.Fit).Items(
X.TabPanel().ID("ArchiveTabPanel")
.Items(
X.GridPanel().ID("GridPanel1").MarginSpec("1 1 1 1").Cls("cust-grid").Title("Archive").Icon(Icon.ServerCompressed)
.Plugins(X.GridFilters())
.View(Html.X().GridView().StripeRows(true).TrackOver(false))
.SelectionModel(X.CheckboxSelectionModel().Mode(SelectionMode.Multi))
.TopBar(
X.Toolbar().MinHeight(35)
.Items(
:
, X.Button()
.Text("View")
.Icon(Icon.PageWhiteAcrobat)
.DirectEvents(de =>
{
de.Click.Action = "Submit";
de.Click.EventMask.ShowMask = true;
de.Click.Method = HttpMethod.POST;
de.Click.ExtraParams.Add(new Parameter()
{
Name = "selection",
Value = "getselection()",
Mode = ParameterMode.Raw
});
de.Click.Timeout = 360000;
})
This is from ArchiveController.cs:
public ActionResult Submit(string selection)
{
int cnt = SetTempData(selection);
RenderWindows(String.Format("View Archive {0}.",cnt),0,cnt);
return this.Direct();
}
[ChildActionOnly]
public void RenderWindows(string title,int download,int cnt)
{
Window win = new Window
{
ID = "Windows1",
Title = title,
Icon = Ext.Net.Icon.PageWhiteAcrobat,
Height = download == 1 ? 150 : 600,
Width = download == 1 ? 400 : 800,
BodyPadding = 2,
Modal = true,
Layout = "Fit",
CloseAction = CloseAction.Destroy,
Loader = new ComponentLoader()
{
Url = Url.Action("ArcTicket", "Archive"),
Mode = LoadMode.Frame,
DisableCaching = true,
ShowWarningOnFailure = true,
LoadMask = { ShowMask = true, Msg = String.Format("Generating {0} pdf ...",cnt) }
},
Buttons = {
new Button(){ Text="Close & Clear", Icon=Ext.Net.Icon.TableRowDelete, Handler="App.GridPanel1.selModel.deselectAll();App.Windows1.close();"},
new Button(){ Text="Close", Icon=Ext.Net.Icon.Cancel, Handler="App.Windows1.close();"}
}
};
win.Loader.Params.Add(new Parameter() { Name = "download", Value = download.ToString(), Mode = ParameterMode.Value });
win.Render(RenderMode.Auto);
}
public FileStreamResult ArcTicket(int download)
{
String id = TempData["xid"].ToString();
TempData.Remove("xid");
String ticket = Uow.TICKETs.GetXmlBatch(id);
Byte[] pdf = MvcApplication.Fop.Write(enumFobFormat.Pdf
, ticket
, Server.MapPath("/Resources/xslt/Ticket.xsl")
);
MemoryStream ms = new MemoryStream(pdf);
FileStreamResult fs = new FileStreamResult(ms, "application/pdf");
if (download == 1)
fs.FileDownloadName = string.Format("Archive_{0:yyyyMMdd_HHmmss}.pdf", DateTime.Now);
return fs;
}
You can make normal button / link with href to ArcTicket action with target="_blank" then it will be opened in new tab
Update:
Change .TopBar to something like this. Option 1 may be problematic because of dynamic parameter from grid and i am not sure it will be possible to pass it there
Option 1:
.TopBar(
X.Toolbar().MinHeight(35)
.Items(
:
, X.Button()
.Text("View")
.Icon(Icon.PageWhiteAcrobat)
.Href(Url.Action("ArcTicket", "Archive"))
.HrefTarget("blank")
.BaseParams("yourparameters")
Option 2
.TopBar(
X.Toolbar().MinHeight(35)
.Items(
:
, X.Button()
.Text("View")
.Icon(Icon.PageWhiteAcrobat)
.Handler("YourJSFUnctionWithWIndowOpen")
I want to make my avatar image which is in a circle clickable. After click it has to be displayed on screen like in FB. So how I can implement this in my code?
listView.Header = "";
listView.HeaderTemplate = new DataTemplate(() =>
{
var avatarLayout = new StackLayout()
{
HeightRequest = 350,
};
var grid = new Grid();
grid.HeightRequest = 400;
grid.BackgroundColor = Color.White;
grid.RowDefinitions.Add(new RowDefinition());
grid.RowDefinitions.Add(new RowDefinition());
var bgrImg = new Image();
bgrImg.Aspect = Aspect.Fill;
bgrImg.Source = ImageSource.FromFile("abstract_background.jpg");
var avImg = new CircleImage();
avImg.VerticalOptions = new LayoutOptions(LayoutAlignment.Center, false);
avImg.Source = ImageSource.FromFile("about_background.png");
grid.Children.Add(bgrImg, 0, 0);
grid.Children.Add(avImg);
Grid.SetRowSpan(avImg, 2);
avatarLayout.Children.Add(grid);
Example of my
avatar
You can make an element tappable by using a GestureRecognizer
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += (s, e) => {
// handle the tap
};
image.GestureRecognizers.Add(tapGestureRecognizer);
I am using Subgurim Map for Setting Marker based on inputed Address. Using GMarker, I am able to load it into Map.
Now this address might be wrong or nearby actual address. So that I am giving opportunity to customer to set actual address with different Marker ( which is bubbled when a button called "Pick Bubble" button )
like,
StringBuilder sb = new StringBuilder();
sb.Append(txtAddress.Text.Trim());
sb.AppendFormat(", {0}", txtCity.Text.Trim());
sb.AppendFormat("- {0}", txtZipcode.Text.Trim());
sb.Append(", Gujarat");
sb.AppendFormat(", {0}", txtCountry.Text.Trim());
GetAddressCordinates googleCordinate = new GetAddressCordinates(Constants.APP_SETTINGS.GoogleMapAPIKey);
Coordinate cordinate = googleCordinate.GetCoordinates(sb.ToString());
GLatLng gLatLng = new GLatLng();
{
gLatLng.lat = double.Parse(cordinate.Latitude.ToString());
gLatLng.lng = double.Parse(cordinate.Longitude.ToString());
}
if (gLatLng != null)
{
GMarker gMarker;
GIcon gIcon = new GIcon();
gIcon.image = ResolveUrl(string.Format("~/Images/ActualFlag.png"));
gIcon.shadow = ResolveUrl(string.Format("~/Images/Shadow.png"));
gIcon.shadowSize = new GSize(30, 30);
gIcon.iconSize = new GSize(24, 24);
GMarkerOptions mOpts = new GMarkerOptions();
mOpts.draggable = true;
mOpts.RaiseOnDrag = true;
mOpts.Animation = GMarkerOptions.AnimationType.Bounce;
mOpts.icon = gIcon;
gMarker = new GMarker(gLatLng, mOpts);
GInfoWindow infoWindow = new GInfoWindow(gMarker, "", false);
GMap1.addInfoWindow(infoWindow);
//GMap1.addGMarker(gMarker);
string jsFunction = string.Format("function(){{ var ev = new serverEvent('dragend', 0); ev.addArg({0}.getPoint().lat()); ev.addArg({0}.getPoint().lng()); ev.send(); }}", gMarker.ID);
GListener listener = new GListener(gMarker.ID, GListener.Event.dragend, "alertame");
GMap1.Add(listener);
GMap1.setCenter(gLatLng);
}
Now I want this two marker position into Button called "NEXT" for manipulate.
How I will get Marker positions ?
Have you tried to put it into GinfoWindow ?
As a string as follows:
dir= "<input type='button' name='next'>"
into:
GInfoWindow infoWindow = new GInfoWindow(gMarker, dir, false);