Skip to content

Instantly share code, notes, and snippets.

View MartinZikmund's full-sized avatar
⌨️
Coding

Martin Zikmund MartinZikmund

⌨️
Coding
View GitHub Profile
@MartinZikmund
MartinZikmund / GravityPlanets.cs
Created February 3, 2019 15:05
Gravity on different planets
SensorManager.GravityMercury //3.7
SensorManager.GravityVenus //8.87
SensorManager.GravityEarth //9.81
SensorManager.GravityMars //3.71
SensorManager.GravityJupiter //23.12
SensorManager.GravityUranus //8.69
SensorManager.GravityNeptune //11
/* SensorManager.GravityPluto //0.6 */
@MartinZikmund
MartinZikmund / GravityDeathStar.cs
Created February 3, 2019 15:11
Gravitational pull on Death Star I
SensorManager.GravityDeathStarI //3.53036143E-07f, in Empire units
@MartinZikmund
MartinZikmund / GravityTheIsland.cs
Created February 3, 2019 15:14
Gravity on The Island
SensorManager.GravityTheIsland //4.815162 - 4 8 15 16 ..
public InputMethodManager GetInputMethodManager() => (InputMethodManager)CrossCurrentActivity.Current.Activity.GetSystemService(Context.InputMethodService);
public void Dismiss()
{
var activity = CrossCurrentActivity.Current.Activity;
var token = activity.CurrentFocus?.WindowToken;
GetInputMethodManager().HideSoftInputFromWindow(token, HideSoftInputFlags.None);
activity.Window.DecorView.ClearFocus();
IsDisplayed = false;
@MartinZikmund
MartinZikmund / Buildlog.txt
Created February 8, 2019 17:20
Build log
Error occurred while restoring NuGet packages: The operation failed as details for project Uno.UI.BindingHelper.Android could not be loaded.
1>------ Build started: Project: Uno.MonoAnalyzers, Configuration: Debug Any CPU ------
2>------ Build started: Project: Uno.UI.Tasks, Configuration: Debug Any CPU ------
3>------ Build started: Project: T4Generator, Configuration: Debug Any CPU ------
3> T4Generator -> C:\Dev\Uno\src\T4Generator\bin\Debug\T4Generator.exe
1>Uno.MonoAnalyzers -> C:\Dev\Uno\src\Uno.MonoAnalyzers\bin\Debug\net46\Uno.MonoAnalyzers.dll
4>------ Build started: Project: Uno.Xaml (Uno.Xaml\Uno.Xaml), Configuration: Debug Any CPU ------
5>------ Build started: Project: Uno.Foundation, Configuration: Debug Any CPU ------
5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.Messaging.targets(41,3): warning VSX1000: No enough information has been provided to MSBuild in order to establish a connection to a Remote Server. The project 'Uno.Foundation' will conti
@MartinZikmund
MartinZikmund / Errorlist.txt
Created February 8, 2019 17:21
Error list
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'CommandBar' could not be found (are you missing a using directive or an assembly reference?) Uno.UI.Toolkit(MonoAndroid80) C:\Dev\Uno\src\Uno.UI.Toolkit\CommandBarExtensions.cs 102 Active
Error CS0246 The type or namespace name 'DependencyProperty' could not be found (are you missing a using directive or an assembly reference?) Uno.UI.Toolkit(MonoAndroid80) C:\Dev\Uno\src\Uno.UI.Toolkit\CommandBarExtensions.cs 19 Active
Error CS0246 The type or namespace name 'CommandBar' could not be found (are you missing a using directive or an assembly reference?) Uno.UI.Toolkit(MonoAndroid80) C:\Dev\Uno\src\Uno.UI.Toolkit\CommandBarExtensions.cs 27 Active
Error CS0246 The type or namespace name 'CommandBar' could not be found (are you missing a using directive or an assembly reference?) Uno.UI.Toolkit(MonoAndroid80) C:\Dev\Uno\src\Uno.UI.Toolkit\CommandBarExtensions.cs 32 Active
Error CS0246 The type or namespace name '
@MartinZikmund
MartinZikmund / OnPlatformWorkaround.xaml
Created February 19, 2019 10:17
OnPlatform workaround for the assets issue on Xamarin.Forms UWP
<Image>
<Image.Source>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS, Android" Value="image.png" />
<On Platform="UWP" Value="Assets/image.png" />
</OnPlatform>
</Image.Source>
</Image>
@MartinZikmund
MartinZikmund / NewImageSearchFolder.cs
Created February 19, 2019 10:23
Upcoming XF feature to set image search directory
Application.Current.On<Windows>().SetImageSearchDirectory("Assets");
@MartinZikmund
MartinZikmund / FileImageMarkupExtensionV1.cs
Last active February 19, 2019 10:43
File image markup extension V1
[ContentProperty(nameof(Path))]
public class FileImageExtension : IMarkupExtension<FileImageSource>
{
public string Path { get; set; }
public FileImageSource ProvideValue(IServiceProvider serviceProvider) => Convert(Path);
public static FileImageSource Convert(string path)
{
if (path == null) throw new InvalidOperationException($"Cannot convert null to {typeof(ImageSource)}");
@MartinZikmund
MartinZikmund / FileImageExtension.xaml
Created February 19, 2019 10:42
Using FileImage extension in XAML
<!-- add XML namespace declaration to page root -->
<ContentPage ...
xmlns:xaml="clr-namespace:YourApp.ExtensionNamespace;assembly=YourApp">
<Image Source="{xaml:FileImage image.png}" />