6.詳細画面
詳細画面
画面は下記の通りです。
クリックすると拡大します
View
<ccl:CustomChromeWindow x:Class="LivetWPFChromeHelpDesk1.Views.Window20" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell" xmlns:ccl="clr-namespace:CustomChromeLibrary;assembly=CustomChromeLibrary" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:l="http://schemas.livet-mvvm.net/2011/wpf" xmlns:core="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" xmlns:v="clr-namespace:LivetWPFChromeHelpDesk1.Views" xmlns:vm="clr-namespace:LivetWPFChromeHelpDesk1.ViewModels" WindowStartupLocation="CenterScreen" Title="Window20" Height="714" Width="1035"> <shell:WindowChrome.WindowChrome> <shell:WindowChrome ResizeBorderThickness="6" CaptionHeight="43" CornerRadius="0,0,0,0" GlassFrameThickness="0"> </shell:WindowChrome> </shell:WindowChrome.WindowChrome> <Window.Resources> <ResourceDictionary> <vm:CaptionButtonRectToMarginConverter x:Key="CaptionButtonMarginConverter"/> <BooleanToVisibilityConverter x:Key="登録実行BoolToVisibility"/> <BooleanToVisibilityConverter x:Key="更新BoolToVisibility"/> <BooleanToVisibilityConverter x:Key="BoolToVisibility"/> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Resources/Styles2.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> <i:Interaction.Triggers> <l:InteractionMessageTrigger MessageKey="MessageKeyDSD1" Messenger="{Binding Messenger}"> <l:TransitionInteractionMessageAction WindowType="{x:Type v:DirectorySearchData}" Mode="Modal"/> </l:InteractionMessageTrigger> <l:InteractionMessageTrigger MessageKey="MessageKeyDSD2" Messenger="{Binding Messenger}"> <l:TransitionInteractionMessageAction WindowType="{x:Type v:DirectorySearchData}" Mode="Modal"/> </l:InteractionMessageTrigger> <!--WindowのContentRenderedイベントのタイミングでViewModelのInitializeメソッドが呼ばれます--> <i:EventTrigger EventName="ContentRendered"> <l:LivetCallMethodAction MethodTarget="{Binding}" MethodName="Initialize"/> </i:EventTrigger> <!-- 下記がないと、タスクバーが1つにならない --> <i:EventTrigger EventName="Loaded"> <i:InvokeCommandAction Command="{Binding Path=Loaded}" CommandParameter="{Binding Mode=OneTime,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}"/> </i:EventTrigger> <i:EventTrigger EventName="Closing"> <i:InvokeCommandAction Command="{Binding Path=Closing}" CommandParameter="{Binding Mode=OneTime,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Window}}}"/> </i:EventTrigger> <l:InteractionMessageTrigger MessageKey="Close" Messenger="{Binding Messenger}"> <l:WindowInteractionMessageAction/> </l:InteractionMessageTrigger> </i:Interaction.Triggers> <!-- Grid-1 --> <Grid> <!-- WindowChrome Start --> <Border Grid.RowSpan="2" BorderThickness="3" BorderBrush="Black"> <Border.Background> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Black" Offset="1" /> </LinearGradientBrush> </Border.Background> </Border> <Border BorderThickness="3,3,3,1" BorderBrush="Black" Margin="{Binding Path=CaptionButtonMargin}"> <Border.Background> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Black" Offset="1" /> </LinearGradientBrush> </Border.Background> <!--Window Icon and Title--> <StackPanel Orientation="Horizontal" Margin="0" VerticalAlignment="Top"> <TextBlock Text=" Help Desk" FontFamily="Calibri" FontWeight="Bold" FontSize="26" Foreground="Blue" /> </StackPanel> </Border> <ccl:CaptionButtons /> <!-- WindowChrome End --> <!-- Grid-2 --> <!--Content--> <Grid Grid.Row="1"> <!-- ★★★ --> <TextBox Text="{Binding Path=txt本日}" TextAlignment="Center" Foreground="White" Background="Black" Height="17" HorizontalAlignment="Center" Name="txt本日" VerticalAlignment="Top" Width="81" Margin="809,3,123,0" /> <TextBlock Padding="0,4,0,0" TextAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="695,86,0,0" Background="#CCFFFF" Name="txtHyperlink" Height="19" Width="166"> <Hyperlink Command="{Binding OpenWebsiteCommand2}" CommandParameter="http://www.aa.cyberhome.ne.jp/~bel/"> <!--Label--> c# Programing Academy </Hyperlink> </TextBlock> <Button Command="{Binding Path=ReInquiryCommand}" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Content="再問い合せ" Foreground="White" Height="24" Margin="802,114,0,0" Name="button1" Width="83"> <Button.Style> <Style TargetType="{x:Type Button}"> <Style.Triggers> <Trigger Property="UIElement.IsMouseOver" Value="True"> <Setter Property="Control.Background" Value="DarkGoldenrod" /> </Trigger> </Style.Triggers> <Setter Property="Control.Background" Value="Green" /> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Control.Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Button.Style> </Button> <Button Command="{Binding Path=UpdateDataCommand}" Content="更新" Name="btnUpdate" Height="24" Width="75" Margin="891,113,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="Black" Visibility="{Binding Is更新Visible, Converter={StaticResource BoolToVisibility}}"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Visibility" Value="Visible"/> <Setter Property="Background" Value="YellowGreen"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <TextBox Text="{Binding Path=txtReceiptNumber}" Height="24" Width="105" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="114,54,0,0" Name="txtReceiptNumber" VerticalAlignment="Top" Foreground="White" Background="Black" /> <Button Command="{Binding Path=ログインユーザー名貼付Command}" Content="貼付" Name="btnログインユーザー名貼付" Height="24" Width="38" Margin="639,54,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <TextBox Text="{Binding Path=txtInquiry}" Width="854" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" TextAlignment="Left" Name="txtInquiry" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="114,205,0,0" Foreground="White" Background="Black" Height="138" /> <Button Command="{Binding Path=InsertDataCommand}" Content="登録実行" Name="btnInsert" Height="24" Margin="891,54,0,0" Visibility="{Binding Is登録実行Visible, Converter={StaticResource BoolToVisibility}}" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="Black" Width="75"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Visibility" Value="Visible"/> <Setter Property="Background" Value="YellowGreen"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Label Content="受付番号" Foreground="White" Height="31" HorizontalAlignment="Left" Margin="15,54,0,0" Name="label1" VerticalAlignment="Top" Width="63" /> <TextBox Text="{Binding Path=txtReceiptDate}" Name="txtReceiptDate" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="114,84,0,0" VerticalAlignment="Top" Width="105" Foreground="White" Background="Black" /> <Label Content="受付年月日時" Foreground="White" Height="31" HorizontalAlignment="Left" Margin="14,84,0,0" Name="label2" VerticalAlignment="Top" Width="93" /> <TextBox Text="{Binding Path=txtState}" Name="txtState" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="114,114,0,0" VerticalAlignment="Top" Width="105" Foreground="Yellow" Background="Black" /> <Label Content="対応状況" Foreground="White" Height="31" HorizontalAlignment="Left" Margin="15,114,0,0" Name="label3" VerticalAlignment="Top" Width="63" /> <TextBox Text="{Binding Path=txtCustomer}" Name="txtCustomer" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="545,54,0,0" VerticalAlignment="Top" Width="88" Foreground="White" Background="Black" /> <Label Content="質問" Foreground="White" Height="23" HorizontalAlignment="Left" Margin="398,57,0,0" Name="label4" VerticalAlignment="Top" Width="38" /> <TextBox Text="{Binding Path=txtProductName}" Name="txtProductName" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="114,144,0,0" VerticalAlignment="Top" Width="773" Foreground="White" Background="Black" /> <Label Content="製品名" Foreground="White" Height="31" HorizontalAlignment="Left" Margin="16,144,0,0" Name="label5" VerticalAlignment="Top" Width="63" /> <Label Content="タイトル" Foreground="White" Height="31" HorizontalAlignment="Left" Margin="16,174,0,0" Name="label6" VerticalAlignment="Top" Width="92" /> <TextBox Text="{Binding Path=txtTitle2}" Name="txtTitle2" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="114,174,0,0" VerticalAlignment="Top" Width="773" Foreground="White" Background="Black" /> <TextBox Text="{Binding Path=txtCompletingDate}" Name="txtCompletingDate" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="538,115,0,0" VerticalAlignment="Top" Width="95" Foreground="White" Background="Black" /> <Label Content="完了日" Foreground="White" Height="23" HorizontalAlignment="Left" Margin="494,115,0,0" Name="label7" VerticalAlignment="Top" Width="48" /> <Label Content="問い合わせ内容" Foreground="White" Height="43" HorizontalAlignment="Left" Margin="16,205,0,0" Name="label8" VerticalAlignment="Top" Width="93" /> <TextBox Text="{Binding Path=txtCorrespondence}" Name="txtCorrespondence" Height="287" Width="854" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" TextAlignment="Left" Margin="114,356,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="White" Background="Black" /> <Label Content="対応内容" Foreground="White" Height="31" Margin="16,356,0,0" Name="label9" HorizontalAlignment="Left" VerticalAlignment="Top" Width="93" /> <Button Command="{Binding Path=InsertダミーCommand}" Content="ダミー" Name="btnダミー" Height="24" Width="50" Margin="225,54,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=Insert本日Command}" Content="本日" Name="btn本日" Height="24" Width="50" Margin="225,84,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=Insert対応中Command}" Content="対応中" Name="btn対応中" Height="24" Width="50" Margin="281,114,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=Insert検証中Command}" Content="検証中" Name="btn検証中" Height="24" Width="50" Margin="393,114,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=Insert完了済Command}" Content="完了済" Name="btn完了済" Height="24" Width="50" Margin="337,114,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=Insert本日2Command}" Content="本日" Name="btn本日2" Height="24" Width="50" Margin="639,113,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=VisibilityボタンCommand}" Content="Fileボタンを表示" Name="btnFileVisible" Height="24" Width="91" Margin="705,114,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Label Content="回目" Foreground="White" Height="24" HorizontalAlignment="Left" Margin="337,56,0,0" Name="label11" VerticalAlignment="Top" Width="38" /> <Label Content="日経過" Foreground="White" Height="24" HorizontalAlignment="Left" Margin="337,84,0,0" Name="label12" VerticalAlignment="Top" Width="50" /> <TextBox Text="{Binding Path=txtNumber}" Name="txtNumber" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="281,53,0,0" VerticalAlignment="Top" Width="50" Foreground="White" Background="Black" /> <TextBox Text="{Binding Path=txtProgressDay}" Name="txtProgressDay" Height="24" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="281,84,0,0" VerticalAlignment="Top" Width="50" Foreground="White" Background="Black" /> <Button Command="{Binding Path=txtMailAddressToClipboardCommand}" Content="←CB" Height="24" Width="34" Margin="851,54,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=txtTitle2ToClipboardCommand}" Content="←CB" Height="24" Width="37" Margin="891,174,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=txtInquiryToClipboardCommand}" Content="CB↓" Name="btnCB3" Height="24" Width="35" Margin="931,174,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=txtProductName編集Command}" Content="貼付" Name="btniBOP" Height="24" Width="35" Margin="931,144,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=txtProductNameToClipboardCommand}" Content="←CB" Height="24" Width="37" Margin="891,144,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=Insert下書Command}" Content="下書" Name="btn下書" Height="24" Width="50" Margin="225,114,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Green"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=txtInquiryClearCommand}" Content="Clear" Name="btntxtInquiryClear" Height="24" Width="36" Margin="974,319,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="White" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="DarkGreen"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <Button Command="{Binding Path=GotoDSD1Command}" Content="File" Name="btntxtInquiryFile" Height="24" Width="36" Margin="73,319,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="Black" Visibility="{Binding IsButtonVisible, Converter={StaticResource BoolToVisibility}}"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Visibility" Value="Visible"/> <Setter Property="Background" Value="YellowGreen"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <TextBox Text="{Binding Path=txtMailAddress}" VerticalContentAlignment="Center" Background="Black" Foreground="White" Height="24" HorizontalAlignment="Left" Margin="683,54,0,0" Name="txtMailAddress" VerticalAlignment="Top" Width="166" /> <TextBox Text="{Binding Path=txtCompany}" VerticalContentAlignment="Center" Background="Black" Foreground="White" Height="24" HorizontalAlignment="Left" Margin="444,54,0,0" Name="txtCompany" VerticalAlignment="Top" Width="98" /> <Label Content="回答" Foreground="White" Height="23" HorizontalAlignment="Left" Margin="398,85,0,0" Name="label10" VerticalAlignment="Top" Width="38" /> <TextBox Text="{Binding Path=txtCorrespondingCompany}" VerticalContentAlignment="Center" Background="Black" Foreground="White" Height="24" HorizontalAlignment="Left" Margin="444,84,0,0" Name="txtCorrespondingCompany" VerticalAlignment="Top" Width="189" /> <!-- <TextBlock Text="{Binding Path=txtHyperlink}" Padding="0,4,0,0" TextAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="683,90,0,0" Background="#FF1E90FF" Name="txtHyperlink" Height="17" Width="166"> <Hyperlink NavigateUri="https://eservice.fujitsu.com/supportdesk/sdk/sdk?sv=0" RequestNavigate="Hyperlink_RequestNavigate"> 富士通サポートデスク </Hyperlink> </TextBlock> --> <!-- <TextBlock> <Hyperlink Command="{Binding OpenSupportWebsiteCommand}" CommandParameter="http://www.aa.cyberhome.ne.jp/~bel/"> <Label Content="富士通サポートデスク" Foreground="White" Height="23" Padding="0,4,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="683,80,0,0" Background="#FF1E90FF" Name="txtHyperlink" Width="166"/> </Hyperlink> </TextBlock> --> <Button Command="{Binding Path=txtCorrespondenceClearCommand}" BorderBrush="{x:Null}" Content="Clear" Foreground="White" Height="24" HorizontalAlignment="Left" Margin="974,619,0,0" Name="btnCorrespondenceClear" VerticalAlignment="Top" Width="36" > <Button.Style> <Style TargetType="{x:Type Button}"> <Style.Triggers> <Trigger Property="UIElement.IsMouseOver" Value="True"> <Setter Property="Control.Background" Value="DarkGoldenrod" /> </Trigger> </Style.Triggers> <Setter Property="Control.Background" Value="DarkGreen" /> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Control.Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Button.Style> </Button> <Button Command="{Binding Path=GotoDSD2Command}" Content="File" Name="btnCorrespondenceFile" Height="24" Width="36" Margin="71,619,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{x:Null}" Foreground="Black" Visibility="{Binding IsButtonVisible, Converter={StaticResource BoolToVisibility}}"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Visibility" Value="Visible"/> <Setter Property="Background" Value="YellowGreen"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="DarkGoldenrod"/> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> <!-- ★★★ --> </Grid> </Grid> </ccl:CustomChromeWindow>
ViewModel
using System; // ObservableCollection using System.Collections.Generic; using System.Linq; //INotifyPropertyChanged //PropertyChanged using System.ComponentModel; //参照設定が必要 //using System.Configuration; using Livet; using Livet.Commands; using Livet.Messaging; //CloseCommand using Livet.Messaging.Windows; //using Livet.Messaging.IO; //using Livet.EventListeners; using System.Data.OracleClient; //ArrayList using System.Collections; //XmlReader using System.Xml; //XDocument using System.Xml.Linq; //XPathDocument using System.Xml.XPath; //RequestNavigateEventArgs //Process.Start using System.Diagnostics; //SystemCommands using Microsoft.Windows.Shell; //ICommand using System.Windows.Input; //MessageBox using System.Windows; // ListCollectionView using System.Windows.Data; //Encoding using System.Text; using LivetWPFChromeHelpDesk1.Models; using LivetWPFChromeHelpDesk1.Views; using LivetWPFChromeHelpDesk1.ViewModels; namespace LivetWPFChromeHelpDesk1.ViewModels { class ViewModel20 : ViewModel { #region 変更通知プロパティ //----------------------------------------------- public string txtMessage { get; set; } public string txt本日 { get; set; } public bool IsEnabled { get; set; } public string txtCorrespondingCompany { get; set; } // private string _txtReceiptNumber; public string txtReceiptNumber { get { return _txtReceiptNumber; } set { if (_txtReceiptNumber != value) { _txtReceiptNumber = value; RaisePropertyChanged("txtReceiptNumber"); } } } // private string _txtNumber; public string txtNumber { get { return _txtNumber; } set { if (_txtNumber != value) { _txtNumber = value; RaisePropertyChanged("txtNumber"); } } } // private string _txtReceiptDate; public string txtReceiptDate { get { return _txtReceiptDate; } set { if (_txtReceiptDate != value) { _txtReceiptDate = value; RaisePropertyChanged("txtReceiptDate"); } } } // //■ private string _txtCompletingDate; public string txtCompletingDate { get { return _txtCompletingDate; } set { if (_txtCompletingDate != value) { _txtCompletingDate = value; RaisePropertyChanged("txtCompletingDate"); } } } // private string _txtState; public string txtState { get { return _txtState; } set { if (_txtState != value) { _txtState = value; RaisePropertyChanged("txtState"); } } } // private string _txtCompany; public string txtCompany { get { return _txtCompany; } set { if (_txtCompany != value) { _txtCompany = value; RaisePropertyChanged("txtCompany"); } } } // private string _txtCustomer; public string txtCustomer { get { return _txtCustomer; } set { if (_txtCustomer != value) { _txtCustomer = value; RaisePropertyChanged("txtCustomer"); } } } // private string _txtMailAddress; public string txtMailAddress { get { return _txtMailAddress; } set { if (_txtMailAddress != value) { _txtMailAddress = value; RaisePropertyChanged("txtMailAddress"); } } } // private string _txtProductName; public string txtProductName { get { return _txtProductName; } set { if (_txtProductName != value) { _txtProductName = value; RaisePropertyChanged("txtProductName"); } } } // private string _txtTitle2; public string txtTitle2 { get { return _txtTitle2; } set { if (_txtTitle2 != value) { _txtTitle2 = value; RaisePropertyChanged("txtTitle2"); } } } // private string _txtInquiry; public string txtInquiry { get { return _txtInquiry; } set { if (_txtInquiry != value) { _txtInquiry = value; RaisePropertyChanged("txtInquiry"); } } } // private string _txtCorrespondence; public string txtCorrespondence { get { return _txtCorrespondence; } set { if (_txtCorrespondence != value) { _txtCorrespondence = value; RaisePropertyChanged("txtCorrespondence"); } } } // private string _txtSearchInquiry; public string txtSearchInquiry { get { return _txtSearchInquiry; } set { if (_txtSearchInquiry != value) { _txtSearchInquiry = value; RaisePropertyChanged("txtSearchInquiry"); } } } // private string _txtProgressDay; public string txtProgressDay { get { return _txtProgressDay; } set { if (_txtProgressDay != value) { _txtProgressDay = value; RaisePropertyChanged("txtProgressDay"); } } } // private string _txt件数; public string txt件数 { get { return _txt件数; } set { if (_txt件数 != value) { _txt件数 = value; RaisePropertyChanged("txt件数"); } } } // private string _txtPath; public string txtPath { get { return _txtPath; } set { if (_txtPath != value) { _txtPath = value; RaisePropertyChanged("txtPath"); } } } // #endregion #region Argument変更通知プロパティ private Argument _argument; public Argument argument { get { return _argument; } set { if (_argument == value) return; _argument = value; RaisePropertyChanged("argument"); } } #endregion string GstrReceiptnumber = ""; string GstrNumber = ""; string GstrTitle = ""; string GstrAction = ""; string GstrPath = ""; // string strヘルプデスク質問 = @"D:\ヘルプデスク質問\"; string strヘルプデスク回答 = @"D:\ヘルプデスク回答\"; static ArrayList Gfiles; Window win = null; public ViewModel20(Argument argument) { Loaded = new Livet.Commands.ListenerCommand<Window>((w) => { if (NeedHideOwner && w.Owner != null && w.Owner.Visibility == Visibility.Visible) { win = w; //w.Owner.Hide(); } }); Closing = new Livet.Commands.ListenerCommand<Window>((w) => { if (NeedHideOwner && w.Owner != null) { w.Owner.Show(); } }); txt本日 = Convert.ToString(DateTime.Today.ToShortDateString()); GstrReceiptnumber = argument.ReceiptNumber; GstrNumber = argument.Number; GstrTitle = argument.Title; GstrAction = argument.Action; GstrPath = argument.XMLPath; if (GstrReceiptnumber != "") { //照会 Is登録実行Visible = false; Is更新Visible = true; Read(); } else { //新規登録 Is登録実行Visible = true; Is更新Visible = false; } //Initialize()では表示されない txt本日 = Convert.ToString(DateTime.Today.ToShortDateString()); if (txtState == "対応中" || txtState == "検証中") { //経過日数 //FileButtonVisuble(); //DateTime値に変換する文字列 string s1 = txtReceiptDate + ":00"; //文字列をDateTime値に変換する DateTime oldDate = DateTime.Parse(s1); //DateTime oldDate = new DateTime(2014, 3, 1); DateTime newDate = DateTime.Now; // Difference in days, hours, and minutes. TimeSpan ts = newDate - oldDate; // Difference in days. int differenceInDays = ts.Days; txtProgressDay = differenceInDays.ToString(); } } public bool NeedHideOwner { get; set; } public ICommand Loaded { get; private set; } public ICommand Closing { get; private set; } public void Initialize() { if (win != null) win.Owner.Hide(); if (GstrAction == "更新") { FileButtonVisuble(); } } #region OpenWebsiteCommand2 ListenerCommand<string> _OpenWebsiteCommand2; public ListenerCommand<string> OpenWebsiteCommand2 { get { if (_OpenWebsiteCommand2 == null) { _OpenWebsiteCommand2 = new ListenerCommand<string>(OpenWebsite, () => true); } return _OpenWebsiteCommand2; } } void OpenWebsite(string str) { if (str == null) { Messenger.Raise(new InformationMessage("Cancel", "Error", MessageBoxImage.Error, "Info")); return; } if (str != null && str.Length > 0) #region FileButtonVisuble private void FileButtonVisuble() { string strファイル名で検索 = txtReceiptNumber.Trim() + "*.*".Trim(); ; string strFolder = ""; string[] stFilePathes = { "" }; strFolder = @strヘルプデスク質問; strFolder = strFolder.Trim(); try { stFilePathes = GetFilesMostDeep(strFolder, "*" + strファイル名で検索); if (stFilePathes.Length != 0) { IsButtonVisible = true; } } catch { } //------------------------------------------------------------------------------------------- strFolder = strFolder = @strヘルプデスク回答; strFolder = strFolder.Trim(); stFilePathes = null; try { stFilePathes = GetFilesMostDeep(strFolder, "*" + strファイル名で検索); if (stFilePathes.Length != 0) { IsButtonVisible = true; } } catch { } } #endregion #region GetFilesMostDeep public static string[] GetFilesMostDeep(string stRootPath, string stPattern) { System.Collections.Specialized.StringCollection hStringCollection = ( new System.Collections.Specialized.StringCollection() ); // このディレクトリ内のすべてのファイルを検索する foreach (string stFilePath in System.IO.Directory.GetFiles(stRootPath, stPattern)) { hStringCollection.Add(stFilePath); } // このディレクトリ内のすべてのサブディレクトリを検索する (再帰) foreach (string stDirPath in System.IO.Directory.GetDirectories(stRootPath)) { string[] stFilePathes = GetFilesMostDeep(stDirPath, stPattern); // 条件に合致したファイルがあった場合は、ArrayList に加える if (stFilePathes != null) { hStringCollection.AddRange(stFilePathes); } } // StringCollection を 1 次元の String 配列にして返す string[] stReturns = new string[hStringCollection.Count]; hStringCollection.CopyTo(stReturns, 0); Gfiles = new ArrayList(hStringCollection); return stReturns; } #endregion private bool _IsButtonVisible; public bool IsButtonVisible { get { return _IsButtonVisible; } set { _IsButtonVisible = value; RaisePropertyChanged("IsButtonVisible"); } } #region VisibilityボタンCommand private ViewModelCommand _VisibilityボタンCommand; public ViewModelCommand VisibilityボタンCommand { get { if (_VisibilityボタンCommand == null) { _VisibilityボタンCommand = new ViewModelCommand(VisibilityButton); } return _VisibilityボタンCommand; } } public void VisibilityButton() { //---------------------- //IsButtonVisible = true; IsButtonVisible = !IsButtonVisible; //---------------------- } //------------------------------------------------- private bool _Is登録実行Visible; public bool Is登録実行Visible { get { return _Is登録実行Visible; } set { _Is登録実行Visible = value; RaisePropertyChanged("Is登録実行Visible"); } } //------------------------------------------------- private bool _Is更新Visible; public bool Is更新Visible { get { return _Is更新Visible; } set { _Is更新Visible = value; RaisePropertyChanged("Is更新Visible"); } } /* 登録実行ボタンと更新ボタンの可視は、他のボタンのClickコマンドで決めるのではないのて VisibilityボタンCommandのようなCommandは不要 */ #endregion /* // https://social.msdn.microsoft.com/Forums/vstudio/en-US/b64387a6-ff0f-4048-b9af-65e801d1f1ea/command-hyperlink?forum=wpf public ICommand OpenSupportWebsiteCommand { get { if (mOpenSupportWebsiteCommand == null) { mOpenSupportWebsiteCommand = new RelayCommand<object>(OpenSupportWebsite); } return mOpenSupportWebsiteCommand; } } private RelayCommand<object> mOpenSupportWebsiteCommand; private void OpenSupportWebsite(object url) { System.Diagnostics.Process.Start(url as string); } */ #region Read private void Read() { XDocument xmlDoc = XDocument.Load(GstrPath); try { var tweets = (from entry in xmlDoc.Descendants("helpdesk") .Where(node => (string)node.Attribute("receiptnumber") == GstrReceiptnumber) .Where(node => (string)node.Attribute("number") == GstrNumber) .Where(node => (string)node.Element("title") == GstrTitle) select new { CorrespondingCompany = entry.Attribute("correspondingcompany").Value, ReceiptNumber = entry.Attribute("receiptnumber").Value, Number = entry.Attribute("number").Value, ReceiptDate = entry.Attribute("receiptdate").Value, Completingdate = entry.Attribute("completingdate").Value, State = entry.Attribute("state").Value, Company = entry.Element("company").Value, Customer = entry.Element("customer").Value, MailAddress = entry.Element("mailaddress").Value, ProductName = entry.Element("productname").Value, Title = entry.Element("title").Value, Inquiry = entry.Element("inquiry").Value, Correspondence = entry.Element("correspondence").Value, } ); //string str = ""; //listBox1.Items.Clear(); foreach (var k in tweets) { txtCorrespondingCompany = k.CorrespondingCompany; txtReceiptNumber = k.ReceiptNumber; txtNumber = k.Number; txtReceiptDate = k.ReceiptDate; txtCompletingDate = k.Completingdate; txtState = k.State; txtCompany = k.Company; txtCustomer = k.Customer; txtMailAddress = k.MailAddress; txtProductName = k.ProductName; txtTitle2 = k.Title; txtInquiry = k.Inquiry; txtInquiry = txtInquiry.Replace("\n", "\r\n"); txtCorrespondence = k.Correspondence; txtCorrespondence = txtCorrespondence.Replace("\n", "\r\n"); break; } //return; //----------------------------------- tweets = null; xmlDoc = null; //GC.Collect(); // //GC.WaitForPendingFinalizers(); //----------------------------------- } catch { } } #endregion #region InsertダミーCommand private ViewModelCommand _InsertダミーCommand; public ViewModelCommand InsertダミーCommand { get { if (_InsertダミーCommand == null) { _InsertダミーCommand = new ViewModelCommand(Insertダミー); } return _InsertダミーCommand; } } public void Insertダミー() { if ((txtReceiptNumber != null) && (txtReceiptNumber.Length != 0)) { System.Windows.Forms.MessageBox.Show("受付番号が未入力でないので、貼付は出来ません。"); } else { string str = DateTime.Today.ToString("d"); str = str.Substring(1, 3) + "-" + str.Substring(5, 2) + str.Substring(8, 2) + "-0000"; txtReceiptNumber = str; } } #endregion #region Insert本日Command private ViewModelCommand _Insert本日Command; public ViewModelCommand Insert本日Command { get { if (_Insert本日Command == null) { _Insert本日Command = new ViewModelCommand(Insert本日); } return _Insert本日Command; } } public void Insert本日() { //txtReceiptDate = Convert.ToString(DateTime.Today.ToString("d")); txtReceiptDate = Convert.ToString(DateTime.Now.ToString("g")); } #endregion #region Insert下書Command private ViewModelCommand _Insert下書Command; public ViewModelCommand Insert下書Command { get { if (_Insert下書Command == null) { _Insert下書Command = new ViewModelCommand(Insert下書); } return _Insert下書Command; } } public void Insert下書() { txtState = "下書"; } #endregion #region Insert対応中Command private ViewModelCommand _Insert対応中Command; public ViewModelCommand Insert対応中Command { get { if (_Insert対応中Command == null) { _Insert対応中Command = new ViewModelCommand(Insert対応中); } return _Insert対応中Command; } } public void Insert対応中() { txtState = "対応中"; } #endregion #region Insert検証中Command private ViewModelCommand _Insert検証中Command; public ViewModelCommand Insert検証中Command { get { if (_Insert検証中Command == null) { _Insert検証中Command = new ViewModelCommand(Insert検証中); } return _Insert検証中Command; } } public void Insert検証中() { txtState = "検証中"; } #endregion #region Insert完了済Command private ViewModelCommand _Insert完了済Command; public ViewModelCommand Insert完了済Command { get { if (_Insert完了済Command == null) { _Insert完了済Command = new ViewModelCommand(Insert完了済); } return _Insert完了済Command; } } public void Insert完了済() { txtState = "完了済"; } #endregion #region ログインユーザー名貼付Command private ViewModelCommand _ログインユーザー名貼付Command; public ViewModelCommand ログインユーザー名貼付Command { get { if (_ログインユーザー名貼付Command == null) { _ログインユーザー名貼付Command = new ViewModelCommand(ログインユーザー名貼付); } return _ログインユーザー名貼付Command; } } private void ログインユーザー名貼付() { txtCompany = "豊洲システム開発"; txtCorrespondingCompany = "C# Programing Academy"; if (txtNumber == "") { txtNumber = "1"; } string[] array = new string[3]; array = ログインユーザー名獲得(); txtCompany = array[0]; //名前 txtCustomer = array[1]; //姓名 txtMailAddress = array[2]; //メールアドレス } private string[] ログインユーザー名獲得() { using (OracleConnection con = new OracleConnection()) { // ユーザー名(ログイン名)の取得 string uName = Environment.UserName; uName = uName.ToUpper(); // 社員マスターと照合 string[] array = new string[3]; // try { con.ConnectionString = "User Id=beluran; Password=beluran; Data Source=beluran;Pooling=false;"; con.Open(); // string CmdString = "SELECT K.会社名 ,S.社員名,S.社員姓名, S.メールアドレス FROM 社員マスター S " + " LEFT JOIN 会社マスター K " + " ON S.会社コード = K.会社コード " + " WHERE S.SYS_DEL_FLG = '0' AND S.ログインコード = '" + uName + "'"; // OracleCommand oracmd = new OracleCommand(CmdString, con); OracleDataReader reader = oracmd.ExecuteReader(); while (reader.Read() == true) { array[0] = reader["会社名"].ToString(); array[1] = reader["社員姓名"].ToString(); array[2] = reader["メールアドレス"].ToString(); } } catch { } finally { } return array; } } //*********************************************** private string[] ログインユーザー名獲得2() { // ユーザー名(ログイン名)の取得 string uName = Environment.UserName; uName = uName.ToUpper(); // 社員マスターと照合 string[] array = new string[3]; int iERR = 0; string cmdstr = ""; using (OracleConnection con = new OracleConnection()) { con.ConnectionString = "User Id=beluran; Password=beluran; Data Source=beluran;Pooling=false;"; con.Open(); //using (OracleTransaction tx = con.BeginTransaction(IsolationLevel.Serializable)) //{ try { string CmdString = "SELECT K.会社名 ,S.社員名,S.社員姓名, S.メールアドレス FROM 社員マスター S " + " LEFT JOIN 会社マスター K " + " ON S.会社コード = K.会社コード " + " WHERE S.SYS_DEL_FLG = '0' AND S.ログインコード = '" + uName + "'"; OracleCommand oracmd = new OracleCommand(CmdString, con); OracleDataReader reader = oracmd.ExecuteReader(); while (reader.Read() == true) { array[0] = reader["会社名"].ToString(); array[1] = reader["社員姓名"].ToString(); array[2] = reader["メールアドレス"].ToString(); } //*** Tran *** //tx.Commit(); } catch (OracleException ex) { iERR = 1; } finally { } } //OracleTransaction tx //} //OracleTransaction tx return array; } #endregion #region Insert本日2Command private ViewModelCommand _Insert本日2Command; public ViewModelCommand Insert本日2Command { get { if (_Insert本日2Command == null) { _Insert本日2Command = new ViewModelCommand(Insert本日2); } return _Insert本日2Command; } } public void Insert本日2() { txtCompletingDate = Convert.ToString(DateTime.Today.ToString("d")); } #endregion #region txtProductName編集Command private ViewModelCommand _txtProductName編集Command; public ViewModelCommand txtProductName編集Command { get { if (_txtProductName編集Command == null) { _txtProductName編集Command = new ViewModelCommand(txtProductName編集); } return _txtProductName編集Command; } } public void txtProductName編集() { txtProductName = "Microsot C# WPF WindowChromeプログラミング"; } #endregion #region ReInquiryCommand private ViewModelCommand _ReInquiryCommand; public ViewModelCommand ReInquiryCommand { get { if (_ReInquiryCommand == null) { _ReInquiryCommand = new ViewModelCommand(ReInquiry2); } return _ReInquiryCommand; } } public void ReInquiry2() { //DialogResult.Yesでエラー //if (System.Windows.Forms.MessageBox.Show("再問い合せは現在の内容で回数を1つアップさせて新しいデータを作成して一覧画面へ戻ります。再問い合せをしないで終了しますか?", "再問い合せの確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) //{ // this.Owner.Show(); // this.Close(); //} //★System.Windows.MessageBox MessageBoxResult result = System.Windows.MessageBox.Show("再問い合せは現在の内容で回数を1つアップさせて新しいデータを作成して一覧画面へ戻ります。再問い合せをしますか?", "再問い合せの確認", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.No) { return; } //--- if (GstrAction == "新規登録") { //System.Windows.Forms.MessageBox.Show("「新規登録」作業の途中です。入力が完了していたら、「登録実行」をクリックして下さい。"); //return; } else { //---------------------------------------- if (txtReceiptDate == "") { System.Windows.Forms.MessageBox.Show("受付番号がブランクです。"); return; } //---------------------------------------- if (Util.IsNumber(txtNumber)) { txtNumber = Convert.ToString(Convert.ToInt32(txtNumber) + 1); } else { System.Windows.Forms.MessageBox.Show("回数が数値ではありません。"); return; } //---------------------------------------- str再問い合せ = "再"; //txtState = "対応中"; txtReceiptDate = DateTime.Now.ToString("g"); txtCompletingDate = ""; //---------------------------------- //Copy & Pasteを反映させる為に入れる //---------------------------------- //System.Windows.Forms.Application.DoEvents(); // InsertSupportDesk(); CheckInsertData(); if (win != null) win.Owner.Show(); win.Close(); } } #endregion #region InsertDataCommand private ViewModelCommand _InsertDataCommand; public ViewModelCommand InsertDataCommand { get { if (_InsertDataCommand == null) { _InsertDataCommand = new ViewModelCommand(CheckInsertData); } return _InsertDataCommand; } } public void CheckInsertData() { if ((txtReceiptNumber != null) && (txtReceiptNumber.Length != 0)) { if (txtReceiptNumber.Length != 13) { System.Windows.Forms.MessageBox.Show("「受付番号の桁数が違います。"); return; } } else{ System.Windows.Forms.MessageBox.Show("受付番号は必須です。決まっていなかったりダミーをクリックして下さい。"); return; } //----------------------------------------- if ((txtCompany != null) && (txtCompany.Length != 0)) { } else { txtCompany = "豊洲システム開発"; } if ((txtCorrespondingCompany != null) && (txtCorrespondingCompany.Length != 0)) { } else { txtCorrespondingCompany = "C# Programing Academy"; } if ((txtNumber != null) && (txtNumber.Length != 0)) { } else { txtNumber = "1"; } if ((txtState != null) && (txtState.Length != 0)) { } else { System.Windows.Forms.MessageBox.Show("対応状況は必須入力です。"); return; } if ((txtTitle2 != null) && (txtTitle2.Length != 0)) { } else { System.Windows.Forms.MessageBox.Show("タイトルは必須入力です。"); return; } InsertData(); } string str再問い合せ = ""; public void InsertData() { //----------------------------------------- //Util.バックアップサポートデスク質問と回答(); //----------------------------------------- string strTitle = ""; if (str再問い合せ == "再") { if (txtTitle2.IndexOf("■") == -1) { strTitle = txtTitle2 + " ■■"; } else { strTitle = txtTitle2; } } else { strTitle = txtTitle2; } if ((txtCompletingDate != null) && (txtCompletingDate.Length != 0)) { } else { txtCompletingDate = ""; } var xelm = XElement.Load(GstrPath); var p = new XElement("helpdesk", new XAttribute("correspondingcompany", txtCorrespondingCompany), new XAttribute("receiptnumber", txtReceiptNumber), new XAttribute("number", txtNumber), new XAttribute("receiptdate", txtReceiptDate), new XAttribute("completingdate",txtCompletingDate), new XAttribute("state", txtState), new XElement("company", txtCompany), new XElement("customer", txtCustomer), new XElement("mailaddress", txtMailAddress), new XElement("productname", txtProductName), new XElement("title", strTitle), new XElement("inquiry", txtInquiry), new XElement("correspondence", txtCorrespondence) ); xelm.Add(p); xelm.Save(GstrPath); /* XDocument xdoc2 = XDocument.Load(GstrPath); XElement e2 = new XElement("helpdesk", xdoc2.Root.Add(e2); xdoc2.Save(GstrPath); */ str再問い合せ = ""; } #endregion #region UpdateDataCommand private ViewModelCommand _UpdateDataCommand; public ViewModelCommand UpdateDataCommand { get { if (_UpdateDataCommand == null) { _UpdateDataCommand = new ViewModelCommand(CheckUpdateData); } return _UpdateDataCommand; } } public void CheckUpdateData() { if (txtReceiptNumber.Length != 13) { System.Windows.Forms.MessageBox.Show("「受付番号の桁数が違います。"); return; } //----------------------------------------- if ((txtCompany != null) && (txtCompany.Length != 0)) { } else { txtCompany = "豊洲システム開発"; } if ((txtCorrespondingCompany != null) && (txtCorrespondingCompany.Length != 0)) { } else { txtCorrespondingCompany = "C# Programing Academy"; } if ((txtNumber != null) && (txtNumber.Length != 0)) { } else { txtNumber = "1"; } //----------------------------------------- //Util.バックアップサポートデスク質問と回答(); //----------------------------------------- UpdateData(); } public void UpdateData() { //XDocument xmlDoc = XDocument.Load(@"HelpDesk.xml"); //XDocument xmlDoc = XDocument.Load(path); var xelm = XElement.Load(GstrPath); var tweets = from entry in xelm.Descendants("helpdesk") //where entry.Attribute("receiptnumber").Value == GstrReceiptnumber //where entry.Attribute("number").Value == GstrNumber //照会したキーで再度検索する .Where(node => (string)node.Attribute("receiptnumber") == GstrReceiptnumber) .Where(node => (string)node.Attribute("number") == GstrNumber) .Where(node => (string)node.Element("title") == GstrTitle) //.Where(node => (string)node.Attribute("receiptnumber") == txtReceiptNumber) //.Where(node => (string)node.Attribute("number") == txtNumber) //.Where(node => (string)node.Element("title") == txtTitle2) select entry; foreach (var help in tweets) { help.Attribute("correspondingcompany").Value = txtCorrespondingCompany; help.Attribute("receiptnumber").Value = txtReceiptNumber; help.Attribute("number").Value = txtNumber; help.Attribute("receiptdate").Value = txtReceiptDate; help.Attribute("completingdate").Value = txtCompletingDate; help.Attribute("state").Value = txtState; help.Element("company").Value = txtCompany; help.Element("customer").Value = txtCustomer; help.Element("mailaddress").Value = txtMailAddress; help.Element("productname").Value = txtProductName; help.Element("title").Value = txtTitle2; help.Element("inquiry").Value = txtInquiry; help.Element("correspondence").Value = txtCorrespondence; xelm.Save(GstrPath); // GstrReceiptnumber = txtReceiptNumber; GstrNumber = txtNumber; GstrTitle = txtTitle2; } } #endregion #region txtMailAddressToClipboardCommand private ViewModelCommand _txtMailAddressToClipboardCommand; public ViewModelCommand txtMailAddressToClipboardCommand { get { if (_txtMailAddressToClipboardCommand == null) { _txtMailAddressToClipboardCommand = new ViewModelCommand(txtMailAddressToClipboard); } return _txtMailAddressToClipboardCommand; } } public void txtMailAddressToClipboard() { System.Windows.Forms.Clipboard.SetText(txtMailAddress); } #endregion #region txtProductNameToClipboardCommand private ViewModelCommand _txtProductNameToClipboardCommand; public ViewModelCommand txtProductNameToClipboardCommand { get { if (_txtProductNameToClipboardCommand == null) { _txtProductNameToClipboardCommand = new ViewModelCommand(txtProductNameToClipboard); } return _txtProductNameToClipboardCommand; } } public void txtProductNameToClipboard() { System.Windows.Forms.Clipboard.SetText(txtProductName); } #endregion #region txtTitle2ToClipboardCommand private ViewModelCommand _txtTitle2ToClipboardCommand; public ViewModelCommand txtTitle2ToClipboardCommand { get { if (_txtTitle2ToClipboardCommand == null) { _txtTitle2ToClipboardCommand = new ViewModelCommand(txtTitle2ToClipboard); } return _txtTitle2ToClipboardCommand; } } public void txtTitle2ToClipboard() { System.Windows.Forms.Clipboard.SetText(txtTitle2); } #endregion #region txtInquiryToClipboardCommand private ViewModelCommand _txtInquiryToClipboardCommand; public ViewModelCommand txtInquiryToClipboardCommand { get { if (_txtInquiryToClipboardCommand == null) { _txtInquiryToClipboardCommand = new ViewModelCommand(txtInquiryToClipboard); } return _txtInquiryToClipboardCommand; } } public void txtInquiryToClipboard() { System.Windows.Forms.Clipboard.SetText(txtInquiry); } #endregion #region txtInquiryClearCommand private ViewModelCommand _txtInquiryClearCommand; public ViewModelCommand txtInquiryClearCommand { get { if (_txtInquiryClearCommand == null) { _txtInquiryClearCommand = new ViewModelCommand(txtInquiryClear); } return _txtInquiryClearCommand; } } public void txtInquiryClear() { txtInquiry = ""; } #endregion #region txtCorrespondenceClearCommand private ViewModelCommand _txtCorrespondenceClearCommand; public ViewModelCommand txtCorrespondenceClearCommand { get { if (_txtCorrespondenceClearCommand == null) { _txtCorrespondenceClearCommand = new ViewModelCommand(txtCorrespondenceClear); } return _txtCorrespondenceClearCommand; } } public void txtCorrespondenceClear() { txtCorrespondence = ""; } #endregion #region GotoCommandDSD //---------------------------------------------------------------- public ViewModelCommand GotoDSD1Command { get { return new Livet.Commands.ViewModelCommand(GotoDSD1); } } public void GotoDSD1() { Argument argument = new Argument(); argument.ReceiptNumber = txtReceiptNumber; argument.Number = txtNumber; argument.Title = txtTitle2; argument.Action = ""; argument.InquiryCorrespondence = "Inquiry"; argument.XMLPath = GstrPath; Messenger.Raise(new TransitionMessage(new DirectorySearchViewModel(argument) { NeedHideOwner = true }, "MessageKeyDSD1")); } //---------------------------------------------------------------- public ViewModelCommand GotoDSD2Command { get { return new Livet.Commands.ViewModelCommand(GotoDSD2); } } public void GotoDSD2() { Argument argument = new Argument(); argument.ReceiptNumber = txtReceiptNumber; argument.Number = txtNumber; argument.Title = txtTitle2; argument.Action = ""; argument.InquiryCorrespondence = "Correspondence"; argument.XMLPath = GstrPath; Messenger.Raise(new TransitionMessage(new DirectorySearchViewModel(argument) { NeedHideOwner = true }, "MessageKeyDSD2")); } //---------------------------------------------------------------- #endregion #region CloseCommand private ViewModelCommand _CloseCommand; public ViewModelCommand CloseCommand { get { if (_CloseCommand == null) { _CloseCommand = new ViewModelCommand(Close); } return _CloseCommand; } } public void Close() { var window = Application.Current.Windows.OfType<Window>().SingleOrDefault((w) => w.IsActive); window.Close(); } #endregion } }