Skip to content

Instantly share code, notes, and snippets.

View MartinZikmund's full-sized avatar
⌨️
Coding

Martin Zikmund MartinZikmund

⌨️
Coding
View GitHub Profile
<Grid>
<TextBlock Text="This is a title" Style="{ThemeResource TitleTextBlockStyle}" />
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" />
</Grid>
var view = item.Content;
if (view.Contains(StandardDataFormats.Bitmap))
{
var bitmapReference = await view.GetBitmapAsync();
if (bitmapReference != null)
{
var bitmap = new BitmapImage();
await bitmap.SetSourceAsync(await bitmapReference.OpenReadAsync());
viewer.ContentGrid.Children.Add(new Image() { Width = 300, Height = 300, Stretch = Stretch.None, Source = bitmap });
}
var historyItems = await Clipboard.GetHistoryItemsAsync();
if (historyItems.Status == ClipboardHistoryItemsResultStatus.Success)
{
foreach (var item in historyItems.Items)
{
// ...
}
}
Clipboard.HistoryEnabledChanged += (S,e) =>
{
if (Clipboard.IsHistoryEnabled())
{
// Retrieve history items
}
}
await Launcher.LaunchUriAsync("ms-settings:clipboard");
if (Clipboard.IsHistoryEnabled())
{
// Retrieve history items
}
// Get number of times the app has been launched
LaunchTracker.Current.LaunchCount
// Get the time when the current instance of app has been launched
LaunchTracker.Current.CurrentLaunchDate
// Get the time the app has been launched last time
LaunchTracker.Current.PreviousLaunchDate
if (LaunchTracker.Current.IsFirstLaunch)
{
// Display pop-up alert for first launch
}
if (LaunchTracker.Current.IsFirstLaunchForCurrentVersion)
{
// Display update notification for current version (1.0.0)
}
if (Settings.IsFirstRun)
{
// Do something.
Settings.IsFirstRun = false;
}
public static class Settings
{
private static ApplicationDataContainer _settings = ApplicationData.Current.LocalSettings;
public static bool IsFirstRun
{
get
{
if (_settings.Values.TryGetValue(nameof(IsFirstRun), out var isFirstRun))
{