Skip to content

Instantly share code, notes, and snippets.

View guntidheerajkumar's full-sized avatar
💭
Happy

Dheeraj Kumar Gunti guntidheerajkumar

💭
Happy
View GitHub Profile
public async Task<List<EmployeeInfo>> GetEmployees()
{
await Initialize();
await SyncEmployees();
return await table.ToListAsync();
}
public async Task SyncEmployees()
{
await client.SyncContext.PushAsync();
public async Task Initialize()
{
if (client?.SyncContext?.IsInitialized ?? false)
{
return;
}
var azureUrl = "http://<<AppName>>.azurewebsites.net";
client = new MobileServiceClient(azureUrl);
var path = "employee.db";
MobileServiceClient client { get; set; }
IMobileServiceSyncTable<EmployeeInfo> table;
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
SQLitePCL.Batteries.Init();
///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);
});
};
///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);
/// 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}");
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();
/// 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!!!!");
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)