Skip to content

Instantly share code, notes, and snippets.

View jlamch's full-sized avatar

Joanna Lamch jlamch

View GitHub Profile
@jlamch
jlamch / AsyncSleepyMethods.BasicSleepyBeforeDecompilation.cs
Last active September 1, 2017 19:17
Basic Sleepy before decompilation
public void Sleepy()
{
Task.Delay(1000).Wait();
//Console.WriteLine("base Sleepy");
}
public void SleepyComplicated(Action slee)
{
slee.Invoke();
@jlamch
jlamch / AsyncSleepyMethods.BasicSleepyAfterDecompilation.cs
Last active September 1, 2017 19:16
BasicSleepyAfterDecompilation
public void Sleepy()
{
Task.Delay(1000).Wait();
}
public void SleepyComplicated(Action slee)
{
slee();
}
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace DecompilationSpying
{
public class AsyncSleepyMethods
{
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace DecompilationSpying
{
public class AsyncSleepyMethods
{
public async Task<string> CallSleepyComplicatedAwaiting()
{
return await CallSleepyComplicatedAwaitingWithFunc(CallSleepyComplicated);
}
//////// VS
public async Task<string> CallSleepyComplicatedAwaiting()
param([string]$xml = 'Web.config', [string]$xdt = 'Web.Preprod.config')
if (!$xml -or !(Test-Path -path $xml -PathType Leaf)) {
throw "File not found. $xml";
}
if (!$xdt -or !(Test-Path -path $xdt -PathType Leaf)) {
throw "File not found. $xdt";
}
cd DesiredTempDirectory
git clone --mirror https://yourvstsaddress.visualstudio.com/defaultCollection/_git/yourProject
cd yourProject.git
git push --mirror https://yourNewAddress.visualstudio.com/defaultCollection/_git/newProjectName
@jlamch
jlamch / Xamarin.Forms.AndroidOnStateChanged.cs
Created August 4, 2018 16:09
Xamarin.Forms Android method OnStateChanged
void OnStateChanged()
{
if (_application == null)
return;
if (_previousState == AndroidApplicationLifecycleState.OnCreate && _currentState == AndroidApplicationLifecycleState.OnStart)
_application.SendStart();
else if (_previousState == AndroidApplicationLifecycleState.OnStop && _currentState == AndroidApplicationLifecycleState.OnRestart)
_application.SendResume();
else if (_previousState == AndroidApplicationLifecycleState.OnPause && _currentState == AndroidApplicationLifecycleState.OnStop)
_application.SendSleep();
@jlamch
jlamch / App.cs
Created August 5, 2018 12:11
Sending lifecycle method through MessagingCenter
using LifeCycleProblem.Models;
using LifeCycleProblem.Views;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace LifeCycleProblem
{
public partial class App : Application
@jlamch
jlamch / BaseContentPage.cs
Created August 5, 2018 12:13
Consume lifecycle messages in BaseContentPage
using LifeCycleProblem.Models;
using LifeCycleProblem.ViewModels;
using Xamarin.Forms;
namespace LifeCycleProblem.Views
{
public class BaseContentPage : ContentPage
{
public BaseViewModel ViewModel { get; set; }