トルネード

毛利のメモ書き

[ .NET Core 2.1]ConfigurationManager app.configデータ取得

Visual Studio 2017 .NET Core 2.1で app.configを使う ConfigurationManager取得 NuGet パッケージマネージャーコンソールでConfigurationManagerを取得 Install-Package System.Configuration.ConfigurationManager -Version 4.5.0 SqlClient 4.5.1を取得 …

Xcode Version 10.0 Mojave ButtonClickイベント

Xcode 10.0 ボタンクリック イベント Xcode Version 10.0 (10A255) でプロジェクトを作成しボタン クリックイベントを作る Main.storyboardを開いて右上のボタンをクリックするとコントロール一覧が出ます。 画面にButtonをドラッグアンドドロップで配置後右…

Ubuntu 18.04.1 desktop にclangをインストール

Ubuntu 18.04にclang 6.0をインストールする sudo apt update sudo apt install clang clang --versionで確認すると clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

-

-

UWP VC++ 画面遷移 Navigate

Visual Studio VC++ 2017のUWPでの画面遷移 以前C#での方法でも書いたが、Navigateを使う。 VC++でのNavigate 画面にボタンを配置し、クリックイベントを作る。 あらかじめ作っておいた「空白のページ」の名前はpage2 作成されたイベントメソッド内に下記を…

UWP C# DynamoDB Query

Visual Studio 2017 UWP C#プロジェクトでDynamoDB Query発行する場合 DynamoDBのQueryを発行する場合、QueryRequest.KeyConditionExpressionに条件を書きます。条件に変数が必要ですが、その変数はExpressionAttributeValuesに設定します。 Itemデータを取…

UWP C# DynamoDB Scan

Visual Studio 2017 C# UWPプロジェクトから DynamoDB接続 AWS SDK for .NET DynamoDB NuGet パッケージをプロジェクトにインストールします。Visual Studio 2017の、[パッケージマネージャーコンソール]から下記のコマンドを入力する。 Install-Package A…

UWP VC++ UTF-8から Platform::String変換

Visual Studio 2017 UWP C++でUTF-8のデータからPlatform::String変換する。 UTF-8の文字列データはstd::stringに収納できるので、一旦stringに入れておく。 std::function<Platform::String ^ (std::string)> Utf8ToPlatformString{ [](std::string stin) { std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;</std::codecvt_utf8_utf16<wchar_t></platform::string>…

UWP VC++ HttpClientオブジェクトを使ったREST問合せ

Visual Studio 2017 UWP C++で、HttpClientオブジェクトを使ったREST問合せ方法 xaml側でButtonとTextBox・ProgressRingを配置します。ButtonクリックイベントでREST問合せし結果をTextBoxに表示します。 問合せ中はProgressRingを動かすようにします。

UWP VC++ JSON文字列データ解析方法

Visual Studio 2017 UWP VC++ の JsonObjectを使ってJSON文字列解析 void cpp_uwp::json_test::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { using namespace Windows::Data::Json; std::function<void(JsonObject^)> hhge{ [this](JsonOb</void(jsonobject^)>…

UWP VC++ JsonObjectでJSONデータ作成

Windows::Data::Json::JsonObject Visual Studio 2017 のUWP VC++ でJSONデータの生成方法です。 JsonObjectは、JSONデータの生成ができます。 xaml側でJSON生成するボタンと出来上がったJSONを表示するためのTextBoxを用意します。

UWP 入門 - HttpClientからJSON取得

Visual Studio 2017 UWP C#で、RESTへ接続しJSON取得するコードです。RESTへの接続は、HttpClientクラスを使います。 JSONデータは下記のようなデータです。 {"hoge":1010,"hoge2":"鉄人"} JSONの文字コードはUTF8です。UTF8のJSONデータ取得してからUnicode…

UWP VC++ Dispatcher->RunAsync()

C++

Visual Studio 2017 UWP VC++でDispatcher->RunAsync Dispatcher.RunAsyncはワーカースレッドから提供されたUIスレッドのコールバックをスケジュールし、結果を非同期的に返します。 もっといい方法あるのかと思うんですが、結局【標準のThread】をつかって…

UWP VC++ タイトルバー透過

「C#でタイトルバー透過」と同じように VC++でもApplicationViewTitleBarを操作します。 //App.xaml.cpp using namespace Windows::UI::ViewManagement; void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) { auto …

UWP VC++ TreeView

Visual Studio 2017 VC++ UWPでのTreeView xaml <Grid> <TreeView Name="TreeView1" Loaded="TreeView1_Loaded" ItemInvoked="TreeView1_ItemInvoked"/> </Grid> VC++コード void test::TreeView1_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { #define IntToStr( ii ) static_cast

UWP 入門 - VC++ std::wstring to Platform::String

Visual Studio 2017 UWP std::wstring からPlatform::String へ std::wstring s1 = L"文字列"; //Platform::String ^s2; Platform::String ^s3 = ref new Platform::String(s1.c_str() ); Platform::String ^s4{ ref new Platform::String(s1.c_str()) }; Pl…

UWP 入門 - VC++ ウィンドウ半透明

Visual Studio 2017 UWP ウィンドウ半透明表示 C++版 Rectangleを半透明にしてウィンドウ壁紙を半透明表示させます。 <Rectangle Fill="Transparent" Name="Rectangle1" Loaded="Rectangle1_Loaded"></Rectangle> using namespace Windows::UI::Composition; public ref class MainPage sealed { Compositor^ _Compositor; SpriteVisual^ _SpriteVisua…

UWP 入門 - ウィンドウ半透明

Visual Studio 2017 のUWPウィンドウ半透明実装方法です。 Compositorクラスは、ビジュアルレイヤ・エフェクトシステム・アニメーションシステムにわたるWindows.UI.Composition名前空間のさまざまなタイプのファクトリとして使用できるアプリケーション用の…

UWP 入門 - TreeView イベント

TreeViewのItemInvokedイベントでアイテムが取得できます。 <TreeView Name="TreeView1" ItemInvoked="TreeView1_ItemInvoked" > </TreeView> args.InvokedItemでTreeViewNodeオブジェクトが取れます。 private void TreeView1_ItemInvoked(TreeView sender, TreeViewItemInvokedEventArgs args) { TextBlock1.Text = ((TreeViewNode)args…

UWP 入門 - TreeViewとTreeViewNode

TreeView Visual Studio 2017 UWPのTreeViewを使ってツリー表示させます。 <TreeView Name="TreeView1"> </TreeView> XAMLファイル側はこれだけです。 private void Page_Loaded(object sender, RoutedEventArgs e) { IList<TreeViewNode> l1 = new List<TreeViewNode>(); for (int i = 0; i < 20; ++i) { l1.Add(new TreeViewNo</treeviewnode></treeviewnode>…

UWP 入門 - SemanticZoom

SemanticZoomとは UWPでの、SemanticZoomとは、グループ化されたデータセットを2つの異なるビュー切替えナビゲートできるコントロールです。 ZoomedInView はコンテンツのメインビューで、個々のデータ項目を表示する。 ZoomedOutView は、 このビューにグル…

UWP 入門 - ダークテーマ設定[RequestedTheme="Dark"]

Visual Studio 2017 UWP アプリダークテーマ設定方法 プロジェクトファイルを作成した際に自動で作られるApp.xamlに追加するだけです。 <Application x:Class="App3.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App3" RequestedTheme="Dark"> </application>

UWP 入門 - Binding データ更新[INotifyPropertyChanged]

下記のxamlコードはGridにTextBlockを貼っただけのシンプルなコードです。 TextプロパティにBindingを書いています。 <Grid> <TextBlock Text="{Binding DtNow}" Loaded="TextBlock_Loaded" Name="TextBlock1"></TextBlock> </Grid> Text="{Binding DtNow}"部分に独自クラスをバインドさせて、クラスからのデータ更新を反映させText表示を変更させます。 独自クラス作…

UWP 入門 - GridView

GridView アイテム追加 簡単なクラスを作成し、GridView のアイテム登録する方法です。 XAMLデザイン画面で下記のようにGridView を追加します。 <GridView Name="gv1" Background="DarkCyan"> <GridView.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Width="250"> </stackpanel></datatemplate></gridview.itemtemplate></gridview>

UWP 入門 - NavigationView メニュー追加

NavigationViewのメニューを追加する方法です。 NavigationView.MenuItemsタグ内にNavigationViewItemを追加します。 <NavigationView HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" FontFamily="Segoe MDL2 Assets" > <NavigationView.MenuItems > </navigationview.menuitems></navigationview>

UWP 入門 - タイトルバーのボタンを透過

前回は、ExtendViewIntoTitleBar = trueにしてタイトルバーの非表示をしました。 引続きタイトルバーのボタンも透過します。 上の図のように右上部のボタンが透過していることが確認できます。 App.xaml.csでのコード 右上部のボタンを透過するには、App.xam…

UWP 入門 - 既存のタイトルバー非表示 ExtendViewIntoTitleBar

既存のタイトルバー非表示 ExtendViewIntoTitleBarをtrueするとタイトルバーが非表示になります。 App.xaml.csにWindows.ApplicationModel.Core追加します。 using Windows.ApplicationModel.Core; App.xaml.csにコード内にOnLaunched()があるので、1行追加 …

UWP 入門 - ComboBox

ComboBox アイテム登録 XAMLで、ComboBox のアイテム登録実装方法です。 <ComboBox HorizontalAlignment="Left" Margin="20,20,0,0" VerticalAlignment="Top" Width="200" Name="c1"> <ComboBoxItem>りんご</ComboBoxItem> <ComboBoxItem>ごりら</ComboBoxItem> <ComboBoxItem>ラッパ</ComboBoxItem> <ComboBoxItem IsSelected="True">パンダ</ComboBoxItem> <…</combobox>

UWP 入門 - Gridの分割方法

UWP

Gridタグの分割 UWPのXAMLは、Pageタグから始まり[空のページ]ではデフォルトでGridのみ記述されています。 このGridタグは、分割する機能があります。 縦に分割 ColumnDefinition <Grid Background="LightGoldenrodYellow"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> </Grid> 横に分割 RowDefinitions <Grid Background="LightGreen"> …</grid>

UWP 入門 - 画面遷移と戻るボタン

MainPage.xaml以外のページに移動 Visual Studio 2017メニューから[新規作成|プロジェクト]を選択すると「新しいプロジェクト」ダイアログが表示されます。[Visual C#|空白のアプリ(ユニバーサルWindows)]でUWPのプロジェクトが作成されます。 その…