This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<List<EmployeeInfo>> GetEmployees() | |
{ | |
await Initialize(); | |
await SyncEmployees(); | |
return await table.ToListAsync(); | |
} | |
public async Task SyncEmployees() | |
{ | |
await client.SyncContext.PushAsync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task Initialize() | |
{ | |
if (client?.SyncContext?.IsInitialized ?? false) | |
{ | |
return; | |
} | |
var azureUrl = "http://<<AppName>>.azurewebsites.net"; | |
client = new MobileServiceClient(azureUrl); | |
var path = "employee.db"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MobileServiceClient client { get; set; } | |
IMobileServiceSyncTable<EmployeeInfo> table; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); | |
SQLitePCL.Batteries.Init(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Showing UIView Animation Slide from Bottom. | |
var sampleView = new UIView(new CGRect(0, this.View.Bounds.Height, this.View.Bounds.Width, 0)); | |
sampleView.BackgroundColor = UIColor.Brown; | |
BtnClick.TouchUpInside += (sender, e) => { | |
UIView.AnimateAsync(0.55f, () => { | |
sampleView.Frame = new CGRect(0, this.View.Bounds.Height - 150, this.View.Bounds.Width, 150); | |
this.View.AddSubview(sampleView); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Playing Video in ViewController | |
var filePath = NSBundle.PathForResourceAbsolute("sample", "gif", NSBundle.MainBundle.BundlePath); | |
var gifData = NSData.FromFile(filePath); | |
VideoWebView.ScalesPageToFit = true; | |
VideoWebView.LoadData(gifData, "image/gif", "gif", new NSUrl("")); | |
var filterView = new UIView(this.View.Frame); | |
filterView.BackgroundColor = UIColor.Black; | |
filterView.Alpha = 0.05f; | |
this.View.AddSubview(filterView); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Creating a json string | |
const string jsondata = "{'FirstName': 'Dheeraj', 'MiddleName':'Kumar' }"; | |
/// We are deserializing the object | |
dynamic customer = JsonConvert.DeserializeObject(jsondata); | |
WriteLine($"{customer.FirstName} ---- {customer.MiddleName}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type excelType = Type.GetTypeFromProgID("Excel.Application", true); | |
dynamic excel = Activator.CreateInstance(excelType); | |
excel.Visible = true; | |
excel.Workbooks.Add(); | |
dynamic worksheet = excel.ActiveSheet; | |
worksheet.Cells[1, "A"] = "This is first Column"; | |
worksheet.Columns[1].AutoFit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Using Reflection | |
StringBuilder sb = new StringBuilder(); | |
sb.GetType().InvokeMember("AppendLine", BindingFlags.InvokeMethod, null, sb, new object[] { "Hello World!!!!" }); | |
/// Using Dynamic CSharp | |
StringBuilder sb = new StringBuilder(); | |
((dynamic)sb).AppendLine("Hello World from Dynamic!!!!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[StringtoTabledata] (@stringarray varchar(max)) | |
RETURNS @tableval TABLE ( | |
tableval int | |
) | |
AS | |
BEGIN | |
DECLARE @seperator char(1) | |
SET @seperator = ',' | |
DECLARE @seperator_position int | |
DECLARE @stringarray_value varchar(8000) |