View gist:4212f2dd384ebdeb4db89277940d3469
This file has been truncated, but you can view the full file.
This file contains 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
ビルドを開始しました... | |
1>------ ビルド開始: プロジェクト: GettingStarted, 構成: Release Any CPU ------ | |
2>------ 公開の開始: プロジェクト: GettingStarted, 構成: Release Any CPU ------ | |
2>SDK 'Microsoft.NET.Sdk' を解決しています... | |
2>$(MSBuildExtensionsPath) で使用されている検索パスは C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild;$(MSBuildProgramFiles32)\MSBuild です | |
2>拡張パス C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild を使用して C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\$(MSBuildToolsVersion)\Microsoft.Common.props をインポートしようとしています | |
2>C:\Users\r23000425 | |
2>$(MSBuildExtensionsPath) で使用されている検索パスは C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild;$(MSBuildProgramFiles32)\MSBuild です | |
2>拡張パス C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild を使用して C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\* をインポートしようとしています | |
2>17.0 |
View pre-configuration.ps1
This file contains 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
scoop install 7zip | |
scoop install sudo | |
scoop install dark | |
scoop install innounp | |
sudo Add-MpPreference -ExclusionPath 'C:\ProgramData\scoop' | |
sudo Add-MpPreference -ExclusionPath $home\scoop | |
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 |
View GitHubCounter.cs
This file contains 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 Newtonsoft.Json.Linq; | |
using System; | |
using System.Net.Http; | |
using System.Linq; | |
using System.Threading.Tasks; | |
public static class GitHubCounter | |
{ | |
public static async Task CountDownload(string owner, string repository) | |
{ |
View GitHubCommitCounter.cs
This file contains 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 Newtonsoft.Json.Linq; | |
using System; | |
using System.Net.Http; | |
using System.Linq; | |
using System.Threading.Tasks; | |
public static class GitHubCommitCounter | |
{ | |
public static async Task Count(string owner, DateTime minDateTime) | |
{ |
View Enumに別名?をつけて表示する.cs
This file contains 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(Gender.Female.ToJapanese()); | |
Console.ReadLine(); | |
} | |
} | |
public enum Gender |
View MockExtensions.cs
This file contains 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 static class MockExtensions | |
{ | |
public static IReturnsResult<T> NotifyPropertyChanged<T, TResult>(this Mock<T> mock, Expression<Func<T, TResult>> expression, TResult setupValue) where T : class, INotifyPropertyChanged | |
{ | |
var memberExpression = expression.Body as MemberExpression; | |
if (memberExpression == null) throw new ArgumentException("expression.Body is not MemberExpression"); | |
var returnResult = mock.Setup(expression).Returns(setupValue); | |
mock.Raise(m => m.PropertyChanged += null, new PropertyChangedEventArgs(memberExpression.Member.Name)); |
View App.xaml.cs
This file contains 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 partial class App : Application | |
{ | |
..... | |
protected override void OnSleep() | |
{ | |
(MainPage.BindingContext as IApplicationLifecycle)?.OnSleep(); | |
} | |
protected override void OnResume() |
View sample.cs
This file contains 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
const string databaseFileName = "sqlite.db3"; | |
// ルートフォルダを取得する | |
IFolder rootFolder = FileSystem.Current.LocalStorage; | |
// ファイルシステム上のDBファイルの存在チェックを行う | |
var result = await rootFolder.CheckExistsAsync(databaseFileName); | |
if (result == ExistenceCheckResult.NotFound) | |
{ | |
// 存在しなかった場合、新たに空のDBファイルを作成する | |
var newFile = await rootFolder.CreateFileAsync(databaseFileName, CreationCollisionOption.ReplaceExisting); | |
// Assemblyに埋め込んだDBファイルをストリームで取得し、空ファイルにコピーする |
View Bootstrapper.cs
This file contains 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
ViewTypeToViewModelTypeResolver _resolver; | |
protected override void ConfigureViewModelLocator() | |
{ | |
base.ConfigureViewModelLocator(); | |
_resolver = new ViewTypeToViewModelTypeResolver(typeof(MainWindowViewModel).Assembly); // とりあえず適当なVMからAssembly取得して設定しておく | |
ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver(_resolver.Resolve); | |
} | |
public class ViewTypeToViewModelTypeResolver | |
{ |
View BitmapSourceExtensions.cs
This file contains 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 static Bitmap ToBitmap(this BitmapSource bitmapSource, PixelFormat pixelFormat) | |
{ | |
int width = bitmapSource.PixelWidth; | |
int height = bitmapSource.PixelHeight; | |
int stride = width * ((bitmapSource.Format.BitsPerPixel + 7) / 8); // 行の長さは色深度によらず8の倍数のため | |
IntPtr intPtr = IntPtr.Zero; | |
try | |
{ | |
intPtr = Marshal.AllocCoTaskMem(height * stride); | |
bitmapSource.CopyPixels(new Int32Rect(0, 0, width, height), intPtr, height * stride, stride); |
NewerOlder