Skip to content

Instantly share code, notes, and snippets.

View linhdh's full-sized avatar
😵
I may be slow to respond.

Linh Peach linhdh

😵
I may be slow to respond.
View GitHub Profile
@linhdh
linhdh / SendFileToServer.cs
Last active October 1, 2023 13:08
[C#] MultiPartFormDataContent, Upload multi files to server at a time.
private static void SendFileToServer(string fileFullPath)
{
FileInfo fi = new FileInfo(fileFullPath);
string fileName = fi.Name;
byte[] fileContents = File.ReadAllBytes(fi.FullName);
Uri webService = new Uri(@"http://avalidwebservice.com");
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, webService);
requestMessage.Headers.ExpectContinue = false;
MultipartFormDataContent multiPartContent = new MultipartFormDataContent("----MyGreatBoundary");
@linhdh
linhdh / AppDelegate.cs
Last active January 3, 2019 12:13
[Xamarin form] Dropdown control
public void ShowSubviewAt(CGRect rect, UIView subView, Action didFinishAnimation)
{
UIView cover = new UIView();
cover.Frame = new CGRect(0, 0, AppWindow.Bounds.Width, AppWindow.Bounds.Height);
//cover.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
//cover.Opaque = true;
cover.BackgroundColor = UIColor.Clear;
cover.AddGestureRecognizer(new UITapGestureRecognizer(() =>
{
@linhdh
linhdh / ButtonRenderer.cs
Created December 19, 2017 06:47
Circular Button Using Xamarin (Custom Renderer)
class CircularButtonRender : Xamarin.Forms.Platform.Android.ButtonRenderer
{
private GradientDrawable _NormalState, _PressedState;
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
base.OnElementChanged(e);
if (Control != null)
{