2 using System.Collections.Generic;
3 using System.Diagnostics;
5 using System.ServiceModel;
6 using System.Windows.Forms;
13 static void Main( string[] args )
15 Application.EnableVisualStyles();
16 Application.SetCompatibleTextRenderingDefault( false );
18 // アプリを生成する。ビュアーモードかどうかの判定も行う。
19 var app = new StrokeStyleT();
21 if( StrokeStyleT.ビュアーモードである )
23 #region " (A) ビュアーモードでの起動(WCFサービスあり)"
25 string serviceUri = "net.pipe://localhost/StrokeStyleT";
26 string endPointName = "Viewer";
27 string endPointUri = $"{serviceUri}/{endPointName}";
30 var serviceHost = new ServiceHost( app, new Uri( serviceUri ) );
32 // 名前付きパイプにバインドしたエンドポイントをサービスホストへ追加する。
33 serviceHost.AddServiceEndpoint(
34 typeof( IStrokeStyleTService ),
35 new NetNamedPipeBinding( NetNamedPipeSecurityMode.None ),
43 catch( AddressAlreadyInUseException )
45 MessageBox.Show( "同じアプリがすでに起動しています。多重起動はできません。", "SST Error", MessageBoxButtons.OK );
64 #region " (B) 通常の起動(WCFサービスなし)"