工具下载地址:https://download.csdn.net/download/m0_37137902/12589801

1WPF页面xaml代码

<Window x:Class="CellPhoneNumberAttribution.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CellPhoneNumberAttribution"
xmlns:Metro="clr-namespace:Arthas.Controls.Metro;assembly=Arthas"
mc:Ignorable="d"
WindowStyle="None"
Height=""
Width=""
Background="Transparent"
Style="{StaticResource Window}"
WindowStartupLocation="CenterScreen"
ShowInTaskbar="True"
x:Name="UserControl1"
Icon="/Images/kunyu.png"
SizeChanged="UserControl1_SizeChanged"
AllowsTransparency="True"
OpacityMask="White" ResizeMode="NoResize">
<Window.Resources>
<ResourceDictionary>
<WindowChrome x:Key="WindowChromeKey">
<WindowChrome.ResizeBorderThickness>
<Thickness></Thickness>
</WindowChrome.ResizeBorderThickness>
</WindowChrome>
</ResourceDictionary>
</Window.Resources> <Grid Margin="">
<Grid >
<Grid.Background>
<VisualBrush>
<VisualBrush.Visual>
<MediaElement>
<MediaElement.Triggers>
<EventTrigger RoutedEvent="MediaElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline x:Name="MP4" Source="..\Resources\花瓣飘落.mp4" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</MediaElement.Triggers>
</MediaElement>
</VisualBrush.Visual>
</VisualBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height=""></RowDefinition>
<RowDefinition Height=""></RowDefinition>
<RowDefinition Height=""></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="" Margin="0,4,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=""></ColumnDefinition>
<ColumnDefinition Width=""></ColumnDefinition>
<ColumnDefinition Width=""></ColumnDefinition>
<ColumnDefinition Width=""></ColumnDefinition>
<ColumnDefinition Width=""></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column=""
x:Name="btn_OpenExcel"
Style="{StaticResource BUTTON_MENUBAR_PATH}"
Background="{x:Null}"
Content="打开文件 "
FontSize=""
VerticalAlignment="Bottom"
Foreground="White"
Click="btn_OpenExcel_Click"
Margin="8,0,0,0"/>
<Grid Grid.Column="">
<TextBlock x:Name="txt_FilePath"
TextTrimming="CharacterEllipsis"
Margin="0,0,0,5"
Width=""
VerticalAlignment="Bottom"
Foreground="White"
FontSize=""
Text="">
</TextBlock>
<Line X1="" Y1="" X2="" Y2="" StrokeEndLineCap="Round" StrokeThickness="">
<Line.Stroke>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,1">
<GradientStop Color="White"/>
<GradientStop Offset=""/>
</LinearGradientBrush>
</Line.Stroke>
</Line>
</Grid> <ComboBox Name="Com_SelectWay"
Style="{StaticResource ComboBoxStyle}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Background="Transparent"
Grid.Column=""
Width=""
Height=""
Text="方式">
<ComboBoxItem Content="本地"></ComboBoxItem>
<ComboBoxItem Content="联网"></ComboBoxItem>
<ComboBoxItem Content="本地/联网"></ComboBoxItem>
</ComboBox>
<Button Grid.Column=""
x:Name="btn_Start"
Style="{StaticResource BUTTON_DISAGREE}"
Content="分析数据"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width=""
Height=""
Foreground="White"
FontSize=""
BorderThickness=""
Click="btn_Start_Click"
/>
<Button Grid.Column=""
x:Name="btn_Close"
Style="{StaticResource BUTTON_MENUBAR_MINI}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width=""
Height="" Click="btn_Close_Click" >
<Button.Background>
<ImageBrush ImageSource="/Images/close.png"/> </Button.Background>
</Button>
</Grid>
<Grid Grid.Row=""> </Grid> <Grid Grid.Row="">
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Metro:MetroProgressBar x:Name="pb2"
Grid.Row=""
Width=""
Margin=""
Grid.Column=""
Value=""
TextHorizontalAlignment="Right"
Maximum="" /> <TextBlock x:Name="txt_Pro"
Grid.Row=""
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"
FontSize=""
Height=""
Width=""
Foreground="White"
/>
<TextBlock x:Name="txt_info"
Grid.Row=""
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"
FontSize=""
Height=""
Width=""
Foreground="White"
/>
</Grid>
<Grid Grid.Row="">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*"></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column=""
x:Name="btn_Export"
Style="{StaticResource BUTTON_DISAGREE}"
Content="导出"
Margin="0,8,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width=""
Height=""
Foreground="White"
FontSize=""
BorderBrush="{x:Null}"
Click="btn_Export_Click"
/> <Button Grid.Column=""
x:Name="btn_Cancel"
Style="{StaticResource BUTTON_DISAGREE}"
Content="取消"
FontSize=""
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width=""
Height=""
Foreground="White"
Margin="0,8,0,0"
Click="btn_Close_Click"
/>
</Grid>
</Grid>
</Grid>
</Window>

2xaml.cs代码

using Microsoft.Win32;
using Org.BouncyCastle.Asn1.Cmp;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media; namespace CellPhoneNumberAttribution
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{ DataTable PhoneNumberDt = new DataTable(); string SelectFilePath = string.Empty; String fileName = string.Empty; List<string> FaildPhoneNumberList = new List<string>(); string API_IphoneNumbers = "https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel="; public MainWindow()
{
InitializeComponent(); this.Loaded += (r, s) =>
{
this.MouseDown += (x, y) =>
{
if (y.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
};
}; string mp4filePath= System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "smjn.mp4";
MP4.Source= new Uri(mp4filePath); } /// <summary>
/// 打开数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_OpenExcel_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "选择数据源文件";
openFileDialog.Filter = "Excel文件(*.xlsx)|*.xlsx|Excel 97-2003文件(*.xls)|*.xls";
openFileDialog.FileName = string.Empty;
openFileDialog.FilterIndex = ;
openFileDialog.Multiselect = false;
openFileDialog.RestoreDirectory = true;
openFileDialog.DefaultExt = "txt";
if (openFileDialog.ShowDialog() == false)
{
return;
}
SelectFilePath = txt_FilePath.Text = openFileDialog.FileName;
} /// <summary>
/// 分析数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_Start_Click(object sender, RoutedEventArgs e)
{
if (File.Exists(SelectFilePath))
{
if (Com_SelectWay.SelectedIndex > -)
{
if (((ComboBoxItem)Com_SelectWay.SelectedItem).Content.ToString().Trim() == "本地")
{
Thread thread = new Thread(new ThreadStart(DataAnalyst));
thread.Start();
txt_Pro.Text = "数据库准备中...";
}
else if (((ComboBoxItem)Com_SelectWay.SelectedItem).Content.ToString().Trim() == "联网")
{
Thread thread = new Thread(new ThreadStart(ApiSelect));
thread.Start();
txt_Pro.Text = "数据库准备中...";
}
else if (((ComboBoxItem)Com_SelectWay.SelectedItem).Content.ToString().Trim() == "本地/联网")
{
Thread thread = new Thread(new ThreadStart(LocalAndApiAnalys));
thread.Start();
txt_Pro.Text = "数据库准备中...";
}
}
else
{
MessageBox.Show("请选择数据分析方式!");
}
}
else
{
MessageBox.Show("请选择电话号码Excel文件路径!");
} } /// <summary>
/// 本地
/// </summary>
private void DataAnalyst()
{ PhoneNumberDt = ReadExcelToDataTable.ReadExcel(SelectFilePath); Dictionary<string, string> DicTableProfessionalTable = new Dictionary<string, string>() { { "电话号码", "number" }, { "省", "province" }, { "市", "city" } }; foreach (DataColumn dc in PhoneNumberDt.Columns)
{
dc.ColumnName = DicTableProfessionalTable[dc.ColumnName];
} DataTable phonesDt = CSQLiteHelper.SelectData("select * from phones"); DataTable regionsDt = CSQLiteHelper.SelectData("select * from regions"); Dictionary<string, string> phonesDic = phonesDt.Rows.Cast<DataRow>().ToDictionary(x => x["number"].ToString(), x => x["region_id"].ToString()); Dictionary<string, string> regionsDic = regionsDt.Rows.Cast<DataRow>().ToDictionary(x => x["id"].ToString(), x => x["province"].ToString() + "省" + x["city"].ToString() + "市"); App.Current.Dispatcher.Invoke((Action)delegate ()
{
txt_Pro.Text = "正在进行分析,请勿关闭程序";
}); for (int i = ; i < PhoneNumberDt.Rows.Count; i++)
{
string number = PhoneNumberDt.Rows[i]["number"].ToString().Trim(); try
{
string region_id = phonesDic[number.Substring(, )]; string area = regionsDic[region_id]; int indexProvince = area.IndexOf("省")+; PhoneNumberDt.Rows[i]["province"] = area.Substring(, indexProvince); PhoneNumberDt.Rows[i]["city"] = area.Substring(indexProvince, area.Length-indexProvince); double pro = Convert.ToDouble(i+) / Convert.ToDouble(PhoneNumberDt.Rows.Count) * ;
App.Current.Dispatcher.Invoke((Action)delegate ()
{
pb2.Value = pro;
//string strs = "当前号吗:" + PhoneNumberDt.Rows[i]["number"].ToString().Trim() + "-" + area;
//txt_Pro.Text = strs;
});
}
catch
{ FaildPhoneNumberList.Add(number);
}
} App.Current.Dispatcher.Invoke((Action)delegate ()
{
txt_Pro.Text = "分析完成!共" + PhoneNumberDt.Rows.Count.ToString() + "条数据。 成功" + (PhoneNumberDt.Rows.Count - FaildPhoneNumberList.Count).ToString() + "个" + "失败" + FaildPhoneNumberList.Count.ToString() + "个,点击导出按钮即可导出分析结果"; txt_info.Text ="失败记录请于" + @"C:\Users\Administrator\Desktop\FaileNumbers.txt" + "文件中查看";
});
} /// <summary>
/// 联网
/// </summary>
private void ApiSelect()
{
PhoneNumberDt = ReadExcelToDataTable.ReadExcel(SelectFilePath); Dictionary<string, string> DicTableProfessionalTable = new Dictionary<string, string>() { { "电话号码", "number" }, { "省", "province" }, { "市", "city" } }; foreach (DataColumn dc in PhoneNumberDt.Columns)
{
dc.ColumnName = DicTableProfessionalTable[dc.ColumnName];
} App.Current.Dispatcher.Invoke((Action)delegate ()
{
txt_Pro.Text = "正在进行分析,请勿关闭程序";
}); for (int i = ; i < PhoneNumberDt.Rows.Count; i++)
{
string number = PhoneNumberDt.Rows[i]["number"].ToString().Trim();
try
{
string result = GetStringByUrl(API_IphoneNumbers + number.Substring(,)); int index = result.IndexOf("province:'"); int indexs = result.IndexOf("catName"); PhoneNumberDt.Rows[i]["province"] = result.Substring(index, indexs - index).Replace("',\n", "").Trim(); double pro = Convert.ToDouble(i + ) / Convert.ToDouble(PhoneNumberDt.Rows.Count) * ; App.Current.Dispatcher.Invoke((Action)delegate ()
{
pb2.Value = pro;
});
}
catch
{
FaildPhoneNumberList.Add(number);
}
} App.Current.Dispatcher.Invoke((Action)delegate ()
{
txt_Pro.Text = "分析完成!共" + PhoneNumberDt.Rows.Count.ToString() + "条数据。 成功" + (PhoneNumberDt.Rows.Count - FaildPhoneNumberList.Count).ToString() + "个" + "失败" + FaildPhoneNumberList.Count.ToString() + "个,点击导出按钮即可导出分析结果"; txt_info.Text = "失败记录请于" + @"C:\Users\Administrator\Desktop\FaileNumbers.txt" + "文件中查看";
});
} /// <summary>
/// 本地/联网
/// </summary>
private void LocalAndApiAnalys()
{
PhoneNumberDt = ReadExcelToDataTable.ReadExcel(SelectFilePath); Dictionary<string, string> DicTableProfessionalTable = new Dictionary<string, string>() { { "电话号码", "number" }, { "省", "province" }, { "市", "city" } }; foreach (DataColumn dc in PhoneNumberDt.Columns)
{
dc.ColumnName = DicTableProfessionalTable[dc.ColumnName];
} DataTable phonesDt = CSQLiteHelper.SelectData("select * from phones"); DataTable regionsDt = CSQLiteHelper.SelectData("select * from regions"); Dictionary<string, string> phonesDic = phonesDt.Rows.Cast<DataRow>().ToDictionary(x => x["number"].ToString(), x => x["region_id"].ToString()); Dictionary<string, string> regionsDic = regionsDt.Rows.Cast<DataRow>().ToDictionary(x => x["id"].ToString(), x => x["province"].ToString() + "省" + x["city"].ToString() + "市"); App.Current.Dispatcher.Invoke((Action)delegate ()
{
txt_Pro.Text = "正在进行分析,请勿关闭程序";
}); for (int i = ; i < PhoneNumberDt.Rows.Count; i++)
{
string number = PhoneNumberDt.Rows[i]["number"].ToString().Trim(); try
{
string region_id = phonesDic[number.Substring(, )]; string area = regionsDic[region_id]; int indexProvince = area.IndexOf("省")+; PhoneNumberDt.Rows[i]["province"] = area.Substring(, indexProvince); PhoneNumberDt.Rows[i]["city"] = area.Substring(indexProvince, area.Length - indexProvince);
//PhoneNumberDt.Rows[i]["province"] = area;//.Substring(0,area.IndexOf("省")); //PhoneNumberDt.Rows[i]["city"] = area.Substring( area.IndexOf("省"),area.Length); double pro = Convert.ToDouble(i + ) / Convert.ToDouble(PhoneNumberDt.Rows.Count) * ;
App.Current.Dispatcher.Invoke((Action)delegate ()
{
pb2.Value = pro;
//string strs = "当前号吗:" + PhoneNumberDt.Rows[i]["number"].ToString().Trim() + "-" + area;
//txt_Pro.Text = strs;
});
}
catch
{
try
{
string result = GetStringByUrl(API_IphoneNumbers + number.Substring(,)); int index = result.IndexOf("province:'"); int indexs = result.IndexOf("catName"); PhoneNumberDt.Rows[i]["province"] = result.Substring(index, indexs - index).Replace("',\n", "").Trim(); double pro = Convert.ToDouble(i + ) / Convert.ToDouble(PhoneNumberDt.Rows.Count) * ; App.Current.Dispatcher.Invoke((Action)delegate ()
{
pb2.Value = pro;
});
}
catch
{
FaildPhoneNumberList.Add(number);
}
}
} App.Current.Dispatcher.Invoke((Action)delegate ()
{
txt_Pro.Text = "分析完成!共" + PhoneNumberDt.Rows.Count.ToString() + "条数据。 成功" + (PhoneNumberDt.Rows.Count - FaildPhoneNumberList.Count).ToString() + "个" + "失败" + FaildPhoneNumberList.Count.ToString() + "个,点击导出按钮即可导出分析结果"; txt_info.Text = "失败记录请于" + @"C:\Users\Administrator\Desktop\FaileNumbers.txt" + "文件中查看";
});
} /// <summary>
/// 抓取网页html代码
/// </summary>
/// <param name="strUrl">URL</param>
/// <returns></returns>
private static string GetStringByUrl(string strUrl)
{
//与指定URL创建HTTP请求
WebRequest wrt = WebRequest.Create(strUrl);
//获取对应HTTP请求的响应
WebResponse wrse = wrt.GetResponse();
//获取响应流
Stream strM = wrse.GetResponseStream();
//对接响应流(以"GBK"字符集)
StreamReader SR = new StreamReader(strM, Encoding.GetEncoding("GB2312"));
//获取响应流的全部字符串
string strallstrm = SR.ReadToEnd();
//关闭读取流
SR.Close();
//返回网页html代码
return strallstrm;
} /// <summary>
/// 导出到Excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_Export_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Excel文件(*.xlsx)|*.xlsx|Excel 97-2003文件(*.xls)|*.xls";
saveFileDialog.FilterIndex = ;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.FilterIndex = ;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.FileName = "电话号码" + DateTime.Now.ToString("yyyyMMddHHmm");
if (saveFileDialog.ShowDialog() == true)
{
fileName = saveFileDialog.FileName.ToString();
if (File.Exists(fileName))
{
File.Delete(fileName);
}
Thread thread = new Thread(new ThreadStart(this.SaveExcel));
thread.Start();
}
} private void SaveExcel()
{ string[] headList;
headList = new string[]
{
"电话号码",
"省",
"市",
};
ReadExcelToDataTable.ExportToExcel(PhoneNumberDt, headList, fileName); if (FaildPhoneNumberList.Count > )
{
FileStream fs = new FileStream(@"C:\Users\Administrator\Desktop\FaileNumbers.txt",FileMode.OpenOrCreate,FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.Flush(); sw.BaseStream.Seek(,SeekOrigin.Begin); for(int i=;i<FaildPhoneNumberList.Count;i++)
{
sw.WriteLine(FaildPhoneNumberList[i]);
}
} Process.Start(fileName);
} /// <summary>
/// 关闭程序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_Close_Click(object sender, RoutedEventArgs e)
{
Environment.Exit();
} /// <summary>
/// 窗体圆角
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UserControl1_SizeChanged(object sender, SizeChangedEventArgs e)
{
System.Windows.Rect r = new System.Windows.Rect(e.NewSize);
RectangleGeometry gm = new RectangleGeometry(r, , ); // 40 is radius here
            ((UIElement)sender).Clip = gm; 
}
}
}

3资源字典

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CellPhoneNumberAttribution">
<Style TargetType="ToggleButton" x:Key="ComboxStyleBtn">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="Back" Background="Transparent" BorderThickness="" BorderBrush="Transparent">
<!--Combox三角-->
<Path Name="PathFill" Fill="White" Width="" Height="" StrokeThickness="" Data="M5,0 L10,10 L0,10 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle=""/>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PathFill" Property="Fill" Value="#f6f5ec"></Setter>
<Setter TargetName="Back" Property="Background" Value="#f6f5ec"></Setter>
<Setter TargetName="Back" Property="BorderBrush" Value="#f6f5ec"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style TargetType="ToggleButton" x:Key="ComboxStyleBtnGray">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="Back" Background="Transparent" BorderThickness="" BorderBrush="Transparent">
<!--Combox三角-->
<Path Name="PathFill" Fill="Gray" Width="" Height="" StrokeThickness="" Data="M5,0 L10,10 L0,10 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle=""/>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PathFill" Property="Fill" Value="#f6f5ec"></Setter>
<Setter TargetName="Back" Property="Background" Value="#f6f5ec"></Setter>
<Setter TargetName="Back" Property="BorderBrush" Value="#f6f5ec"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <ControlTemplate x:Key="CBCustomToggleButton" TargetType="ToggleButton">
<Grid>
<Border Name="Border"
BorderThickness="1,1,1,1"/>
<Border Name="SmallBorder"
BorderThickness="0,0,1,0" />
<Path Name="Arrow"
Width=""
Data="M0,0 L0,2 L4,6 L8,2 L8,0 L4,4 z"
Fill="White" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="White" />
<Setter TargetName="SmallBorder" Property="BorderBrush" Value="White" />
<Setter TargetName="Arrow" Property="Fill" Value="White" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="White" />
<Setter TargetName="SmallBorder" Property="BorderBrush" Value="White" />
</Trigger>
<Trigger Property="UIElement.IsEnabled" Value="False">
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate> <Style x:Key="MyComBoxStyle" TargetType="{x:Type ComboBox}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Name="ToggleButton"
Template="{StaticResource CBCustomToggleButton}" />
<ContentPresenter Name="ContentSite"
Content="{TemplateBinding ComboBox.SelectionBoxItem}"/>
<TextBox x:Name="PART_EditableTextBox"
Foreground="{TemplateBinding Foreground}"
IsReadOnly="{TemplateBinding IsReadOnly}"
Background="Transparent"
Visibility="Hidden" />
<Popup Name="PART_Popup">
<Grid Name="DropDown"
MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
MaxHeight="{TemplateBinding ComboBox.MaxDropDownHeight}"
SnapsToDevicePixels="True">
<Border Name="DropDownBorder"
Background="{TemplateBinding ComboBox.Background}">
<ScrollViewer Margin="4,6,4,6">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="PART_Popup" Property="Window.AllowsTransparency" Value="True">
<Setter TargetName="DropDownBorder" Property="FrameworkElement.Margin" Value="0,2,0,0" />
</Trigger>
<Trigger Property="ComboBox.IsEditable" Value="True">
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter TargetName="PART_EditableTextBox" Property="UIElement.Visibility" Value="Visible" />
<Setter TargetName="ContentSite" Property="UIElement.Visibility" Value="Hidden" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Border>
<ContentPresenter />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <ControlTemplate x:Key="CustomToggleButton" TargetType="ToggleButton">
<Grid>
<Border Name="Border" />
<Border Name="SmallBorder" />
<Path Name="Arrow" />
</Grid>
</ControlTemplate>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Template="{StaticResource CustomToggleButton}" />
<ContentPresenter />
<TextBox />
<Popup>
<Grid>
<Border>
<ScrollViewer>
<ItemsPresenter />
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <!--Combox-->
<Style TargetType="ComboBox" x:Key="ComboBoxStyle">
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="Height" Value=""></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="Width" Value=""></Setter>
<Setter Property="FontSize" Value=""></Setter>
<Setter Property="Foreground" Value="#a1a3a6"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#a1a3a6" >
<ContentPresenter ContentSource="{Binding Source}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="#d3c6a6"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="#f6f5ec"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.3*" MaxWidth=""/>
</Grid.ColumnDefinitions>
<!--Combox分为Textbox Border Popup三个控件-->
<TextBox Grid.Column="" Foreground="White" FontSize="" Background="Transparent" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
IsReadOnly="{TemplateBinding IsReadOnly}" BorderBrush="Transparent" Text="{TemplateBinding Text}"></TextBox>
<Border Grid.Column="" BorderThickness="1,1,0,1" BorderBrush="White" CornerRadius="7,0,0,7"> </Border>
<Border Grid.Column="" BorderThickness="0,1,1,1" BorderBrush="White" CornerRadius="0,7,7,0">
<ToggleButton Style="{StaticResource ComboxStyleBtn}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
</Border>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="" ShadowDepth="" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" Style="{DynamicResource ScrollViewerStyle}" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style TargetType="ComboBox" x:Key="ComboBoxStyleGray">
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="Height" Value=""></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="Width" Value=""></Setter>
<Setter Property="FontSize" Value=""></Setter>
<Setter Property="Foreground" Value="#a1a3a6"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#a1a3a6" >
<ContentPresenter ContentSource="{Binding Source}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="#d3c6a6"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="#f6f5ec"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.3*" MaxWidth=""/>
</Grid.ColumnDefinitions>
<!--Combox分为Textbox Border Popup三个控件-->
<TextBox Grid.Column="" Foreground="Gray" FontSize="" Background="Transparent" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
IsReadOnly="{TemplateBinding IsReadOnly}" BorderBrush="Transparent" Text="{TemplateBinding Text}"></TextBox>
<Border Grid.Column="" BorderThickness="1,1,0,1" BorderBrush="Gray" CornerRadius="7,0,0,7"> </Border>
<Border Grid.Column="" BorderThickness="0,1,1,1" BorderBrush="Gray" CornerRadius="0,7,7,0">
<ToggleButton Style="{StaticResource ComboxStyleBtnGray}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
</Border>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="" ShadowDepth="" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" Style="{DynamicResource ScrollViewerStyle}" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style x:Key="Window" TargetType="Window">
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="AllowsTransparency" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="BUTTON_MENUBAR" TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
<Grid Name="g" Opacity="" Background="LightGray"/>
<Grid Name="grd" RenderTransformOrigin="0.5,0.5" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" VerticalAlignment="Center" HorizontalAlignment="Center" >
<Grid.RenderTransform>
<TransformGroup>
<!--<RotateTransform x:Name="rotate" Angle=""-->
<ScaleTransform x:Name="scale" ScaleX="0.8" ScaleY="0.8"/>
</TransformGroup>
</Grid.RenderTransform>
</Grid>
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.2" Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleX" />
<DoubleAnimation To="" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleY" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="" Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="0.8" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleX" />
<DoubleAnimation To="0.8" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleY" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BUTTON_MENUBAR_PATH" TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Foreground" Value="Gray" />
<Setter Property="Height" Value=""/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
<Grid Name="g" Background="LightGray" Opacity="" />
<Grid Name="grd" Width="" Height="" Background="{TemplateBinding Background}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
<Path Width="" Height="" HorizontalAlignment="Right" VerticalAlignment="Center" Data="M3,10 L7,15 L3,20" Stroke="White" StrokeThickness=""/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.4" Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard> </Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BUTTON_MENUBAR_MINI" TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" ClipToBounds="True">
<Border Name="bdr" BorderBrush="LightGray" BorderThickness="" Opacity="">
<Border.Effect>
<DropShadowEffect x:Name="effect" BlurRadius="" Opacity="0.8" ShadowDepth="" Color="LightGray"/>
</Border.Effect>
</Border>
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" VerticalAlignment="Center" HorizontalAlignment="Center" > </Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="" Duration="0:0:0.3" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="" Duration="0:0:0.3" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Button}" x:Key="DefaultButtonWhite">
<Setter Property="Foreground" Value="Gray"/>
<Setter Property="FontFamily" Value="Microsoft YaHei"/>
<Setter Property="FontSize" Value=""/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Height" Value=""/>
<Setter Property="Width" Value=""/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border" BorderBrush="#4977FC" BorderThickness="" CornerRadius="15,15,15,15">
<Border.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="White" Offset="0.0" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#4977FC"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#5CACEE"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Button}" x:Key="DefaultButtonBlue">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Microsoft YaHei"/>
<Setter Property="FontSize" Value=""/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Height" Value=""/>
<Setter Property="Width" Value=""/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="" CornerRadius="20,20,20,20">
<Border.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4977FC" Offset="0.0" />
<GradientStop Color="#4977FC" Offset="0.2" />
<GradientStop Color="#4977FC" Offset="0.0" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style x:Key="BUTTON_AGREE" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="bdr" CornerRadius="" Opacity="0.5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="">
<!--可使用ContentPresenter代替-->
<!--Foreground的值White可以替换为{TemplateBinding Foreground}-->
<Label VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Foreground="White" Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.7" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.5" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style x:Key="BUTTON_DISAGREE" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="" BorderBrush="#FFEBEBEB" BorderThickness="">
<Grid>
<Border Name="bdr" CornerRadius="" Background="Gray" Opacity=""/>
<Label VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.2" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard> </Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <Style x:Key="BtnInfoStyle" TargetType="Button">
<Setter Property="Width" Value=""/>
<Setter Property="Height" Value=""/>
<Setter Property="Foreground" Value="Gray"/>
<Setter Property="BorderThickness" Value=""/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="Transparent"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="Transparent"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> <SolidColorBrush x:Key="SOLIDCOLORBRUSH_LIGHT" Color="#FF6FD1FF"/>
<Color x:Key="COLOR_LIGHT" R="" G="" B="" A="" /> <Style x:Key="BUTTON_ELLIPSE" TargetType="{x:Type Button}">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="ToolTip" Value="下一步"/> <Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="" Width="" Height="" Background="{DynamicResource SOLIDCOLORBRUSH_LIGHT}">
<Border.Effect>
<DropShadowEffect x:Name="effect" BlurRadius="" Opacity="0.6" ShadowDepth="" Color="{DynamicResource COLOR_LIGHT}"/>
</Border.Effect>
<Grid>
<Path Name="path" HorizontalAlignment="Left" Margin="0,0,0,0" Data="M5,15 L 15,23 L24,9" Stroke="White" StrokeThickness=""/>
<Path Name="path2" HorizontalAlignment="Left" Opacity="" Margin="0,0,0,0" Data="M5,15 H25 L17,7 M25,15 L17,22 " Stroke="White" StrokeThickness=""/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.9" Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="" Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="BlurRadius" />
<DoubleAnimation To="" Duration="0:0:0.5" Storyboard.TargetName="path" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="" Duration="0:0:0.5" BeginTime="0:0:0.3" Storyboard.TargetName="path2" Storyboard.TargetProperty="Opacity" /> </Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="BlurRadius" />
<DoubleAnimation Duration="0:0:0.5" BeginTime="0:0:0.3" Storyboard.TargetName="path" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation Duration="0:0:0.5" Storyboard.TargetName="path2" Storyboard.TargetProperty="Opacity" /> </Storyboard>
</BeginStoryboard> </Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

4读取导出Excel与DataTable转换的类

 public  class ReadExcelToDataTable
{
/// <summary>
/// Excel->DataTable
/// </summary>
/// <param name="filePath">Excel文件路径</param>
public static DataTable ReadExcel(string filePath)
{
IWorkbook iwkX;
using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
iwkX = WorkbookFactory.Create(fs);
fs.Close();
}
//sheet
DataTable dt = new DataTable();
for (int h = ; h < iwkX.NumberOfSheets; h++)
{
ISheet sheet = iwkX.GetSheetAt(h);
var rows = sheet.GetRowEnumerator();
bool isMove = rows.MoveNext();
//循环sheet
if (isMove)
{
var Cols = (IRow)rows.Current;
dt.TableName = sheet.SheetName;
for (int i = ; i < Cols.LastCellNum; i++)
{
string str = Cols.GetCell(i).ToString();
dt.Columns.Add(Cols.GetCell(i).ToString());
}
while (rows.MoveNext())
{
var row = (IRow)rows.Current;
var dr = dt.NewRow();
for (int i = ; i < row.LastCellNum; i++)
{
var cell = row.GetCell(i);
if (cell == null)
{
dr[i] = "";
}
else
{
string strdr = cell.ToString();
dr[i] = cell.ToString();
}
}
dt.Rows.Add(dr);
}
}
} return dt;
} /// <summary>
/// DataTable导出到Excel
/// </summary>
/// <param name="dt">DataTable</param>
/// <param name="array">首行数组</param>
/// <param name="fileFullName">文件名</param>
public static void ExportToExcel(DataTable dt, string[] array, string fileFullName)
{
#region
XSSFWorkbook workbook = new XSSFWorkbook();
FileStream fs = new FileStream(fileFullName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
ISheet sheet = workbook.CreateSheet("Sheet0");
IRow row;
row = sheet.CreateRow(); for (int i = ; i < array.Length; i++)
{
row.CreateCell(i).SetCellValue(array[i]);
} for (int i = ; i < dt.Rows.Count; i++)
{
row = sheet.CreateRow(i + ); for (int j = ; j < dt.Columns.Count; j++)
{
row.CreateCell(j).SetCellValue(dt.Rows[i][j].ToString());
}
}
workbook.Write(fs); //写入到excel #endregion
// MessageBox.Show("导出成功!");
}
}

5数据库:数据库415281条数据,很全,在下载的Demo里   phone.db

6在下的文件中(有使用说明)点击Debug目录下的CellPhoneNumberAttribution.exe运行,注意电脑上要装.NET Framework 4.5

WPF手机号码归属批量查询并导出到Excel的更多相关文章

  1. PHP实现 手机号码归属地查询

    在工作中需要对手机号码进行归属地查询,就在网上找了下解决方案,发现通过号段非常好判断. 我将数据库文件放到了百度网盘,请有需要的朋友去下载. 链接: https://pan.baidu.com/s/1 ...

  2. 【原创】Java实现手机号码归属地查询

    网络上已经有很多的手机号码归属地查询的API接口,但是这些接口总是有一些大大小小的缺陷. 总结一下这些缺陷: 1.要直接将它的搜索框链接形式粘到自己的页面,点击查询的时候还要跳转到他们的网站来展示归属 ...

  3. 本地的手机号码归属地查询-oracle数据

    最近做的项目中,有个功能是手机归属地查询,因为项目要在内网下运行,所以不能用提供的webservice,只好在网上找手机归属地的数据,很多都是access的,我们的项目是用oracle,只好自己转吧, ...

  4. 百度手机号码归属地查询api与返回json处理

    前天无意间在网上看到百度ApiStore,然后好奇就进去看了看.正好最近在某博培训Android,刚学到java基础.抱着锻炼的心态选择手机号码归属地查询api进行练手.api地址 (http://a ...

  5. 免费的手机号码归属地查询API接口文档

    聚合数据手机号码归属四查询API接口,根据手机号码或手机号码的前7位,查询手机号码归属地信息,包括省份 .城市.区号.邮编.运营商和卡类型. 通过链接https://www.juhe.cn/docs/ ...

  6. C# Winform实现手机号码归属地查询工具

    摘要:本文介绍使用C#开发基于Winform的手机号码归属地查询工具,并提供详细的示例代码供参考. 一.需求描述 输入正确的手机号码,查询该号码的归属地和其他相关信息. 二.需求分析 1.实现手机号码 ...

  7. java 手机号码归属地查询

    下面是利用第三方接口实现手机号码归属地查询 (复制请标明出处或留言) package com.test.yyc; import java.io.BufferedReader; import java. ...

  8. atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结

    atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结 1. 基本的流程 查询获得list 读取jsp的table获得标题and 字段的map to ...

  9. wpf 窗口程序下将datagrid导出为excel

    今天用了几个小时也没有找到将datagrid导出为excel的方法,搜索msdn发现,老外也木有解决这个问题,因此把代码贴出来,和大家分享一下,提高工作效率.简要说一哈,本程序使用反射,因此代码量看起 ...

随机推荐

  1. MySQL 8.0 yum安装和配置

    MySQL 8.0 centos7.5 x86_64 一.yum安装 1.先卸载机器和mysql有关的东西,有的安装了mariab-lib,会对安装有干扰,卸载了它. [root@localhost ...

  2. 我们是如何做DevOps的?

    一.DevOps的理解 DevOps的概念理解 DevOps 的概念在软件开发行业中逐渐流行起来.越来越多的团队希望实现产品的敏捷开发,DevOps 使一切成为可能.有了 DevOps ,团队可以定期 ...

  3. 关键时刻,让你的iphone拒绝掉的所有来电

    夜间被骚扰电话吵醒是会非常烦躁的,以下就是iphone的勿扰模式,配合刚出的夜间深夜模式非常的nice. 可以自定义设置时间段,每天智能切换. 也可以开启个人收藏的白名单,让家人有紧急事情也可以联系到 ...

  4. java.net.URISyntaxException 问题解决

    先上代码: Properties pro = PropertyUtil.getPropertiesInfo("xxx.properties"); String url = pro. ...

  5. IDEA之maven配置详解

    这两天被maven配置搞得焦头烂额,前后忙活了三天才彻底搞定. 下面我总结一下配置的步骤. 步骤 1. 首先去maven官网去下载maven,http://maven.apache.org/ 这里教大 ...

  6. Windows 程序设计(4) MFC-01前置知识

    1. Windows编程简介 1.0 开发环境 操作系统 Win10 IDE: VS2017 1.1 Windows程序简介 Windows程序呢也主要分那么几种,例如:exe的可执行程序,dll的动 ...

  7. rust 代码生成选项

    Available codegen options: -C ar=val -- this option is deprecated and does nothing -C linker=val -- ...

  8. WeChair项目Alpha冲刺(4/10)

    团队项目进行情况 1.昨日进展    Alpha冲刺第四天 昨日进展: 前端完成小程序登录态的定义 LoginController编写初步完成同时修改并更新了代码,但是在将编码好的项目部署到服务器上时 ...

  9. 使用DragonFly进行智能镜像分发

    Dragonfly 是一款基于 P2P 的智能镜像和文件分发工具.它旨在提高文件传输的效率和速率,最大限度地利用网络带宽,尤其是在分发大量数据时,例如应用分发.缓存分发.日志分发和镜像分发. 在阿里巴 ...

  10. 为什么用抓包工具看HTTPS包是明文的

    测试或者开发调试的过程中,经常会进行抓包分析,并且装上抓包工具的证书就能抓取 HTTPS 的数据包并显示.由此就产生了一个疑问,为什么抓包工具装上证书后就能抓到 HTTPS 的包并显示呢?不是说 HT ...