Commit 95a8e74e authored by 540597360@qq.com's avatar 540597360@qq.com

取消AirRingShift的无用按钮;应用Unity

parent c5fb85fb
...@@ -206,6 +206,10 @@ ...@@ -206,6 +206,10 @@
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Project.FLY.Thick.Blowing\FLY.Thick.Blowing\FLY.Thick.Blowing.csproj">
<Project>{cc20abeb-59f6-492b-a963-51121eb5ae66}</Project>
<Name>FLY.Thick.Blowing</Name>
</ProjectReference>
<ProjectReference Include="..\..\thick_public\MultiLayout\MultiLayout.csproj"> <ProjectReference Include="..\..\thick_public\MultiLayout\MultiLayout.csproj">
<Project>{5BBE76F5-CFD7-4DFA-9EE5-0C47D77D96E6}</Project> <Project>{5BBE76F5-CFD7-4DFA-9EE5-0C47D77D96E6}</Project>
<Name>MultiLayout</Name> <Name>MultiLayout</Name>
......
...@@ -29,9 +29,15 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -29,9 +29,15 @@ namespace FLY.HeatingHelper.UI.UiModule
public HeatThickDetector() public HeatThickDetector()
{ {
InitializeComponent(); InitializeComponent();
var _dat = DataManager.GetThickDataInstance(); }
_dat.DBPath = @"D:\blowingdata\airring.sqlite3";
vm = new ViewModel_HeatThickDetector(_dat); private IUnityContainer container;
[InjectionMethod]
public void Init(IUnityContainer container,IThickHeatData dat)
{
this.container = container;
vm = new ViewModel_HeatThickDetector(dat);
this.DataContext = vm; this.DataContext = vm;
} }
...@@ -44,7 +50,7 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -44,7 +50,7 @@ namespace FLY.HeatingHelper.UI.UiModule
if(vm._dat.BeginUse()) if(vm._dat.BeginUse())
{ {
Page_HeatDetector page = new Page_HeatDetector(); Page_HeatDetector page = new Page_HeatDetector();
page.InitData(vm._dat); container.BuildUp(page);
ns.Navigate(page); ns.Navigate(page);
} }
} }
...@@ -62,7 +68,10 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -62,7 +68,10 @@ namespace FLY.HeatingHelper.UI.UiModule
public FrameworkElement GetComponent(int id,IUnityContainer container) public FrameworkElement GetComponent(int id,IUnityContainer container)
{ {
return container.Resolve<HeatThickDetector>(); return container.Resolve<HeatThickDetector>();
//HeatThickDetector fe = new HeatThickDetector(); //HeatThickDetector fe = new HeatThickDetector();
//IThickHeatData dat = container.Resolve<IThickHeatData>();
//fe.Init(container, dat);
//return fe; //return fe;
} }
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
</StackPanel > </StackPanel >
<TabControl Name="tc1" Style="{DynamicResource TabControlStyle_ABC}" > <TabControl Name="tc1" Style="{DynamicResource TabControlStyle_ABC}" >
<TabItem Header="数据选择" Style="{DynamicResource TabItemStyle1}"> <TabItem Header="数据选择" Style="{DynamicResource TabItemStyle1}">
<local1:UC_SelectData/> <local1:UC_SelectData x:Name="uc_SelectData"/>
</TabItem> </TabItem>
<TabItem Header="风环偏转" Style="{DynamicResource TabItemStyle1}" x:Name="tabitem_ringShift"> <TabItem Header="风环偏转" Style="{DynamicResource TabItemStyle1}" x:Name="tabitem_ringShift">
<local:UC_AirRingShift x:Name="uc_airRingShift"> <local:UC_AirRingShift x:Name="uc_airRingShift">
......
...@@ -20,6 +20,7 @@ using System.Windows.Navigation; ...@@ -20,6 +20,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using FLY.HeatingHelper; using FLY.HeatingHelper;
using System.Threading.Tasks; using System.Threading.Tasks;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule namespace FLY.HeatingHelper.UI.UiModule
{ {
...@@ -36,16 +37,25 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -36,16 +37,25 @@ namespace FLY.HeatingHelper.UI.UiModule
InitializeComponent(); InitializeComponent();
} }
private IUnityContainer container;
[InjectionMethod]
public void Init(IUnityContainer container, IThickHeatData dat)
{
Dat = dat as IThickHeatData;
container.BuildUp(uc_SelectData);
container.BuildUp(uc_airRingShift);
container.BuildUp(uc_heatBoltAnalyst);
}
public IThickHeatData Dat { get; set; } public IThickHeatData Dat { get; set; }
public void InitData(object dat) public void InitData()
{ {
//_vm = ViewModel_HeatDetector.Instance; //_vm = ViewModel_HeatDetector.Instance;
//_vm.SetData(dat as IThickHeatData); //_vm.SetData(dat as IThickHeatData);
//this.DataContext = _vm; //this.DataContext = _vm;
Dat = dat as IThickHeatData;
uc_airRingShift.Init(dat);
uc_heatBoltAnalyst.Init(dat);
} }
private void button_back_Click(object sender, RoutedEventArgs e) private void button_back_Click(object sender, RoutedEventArgs e)
......
...@@ -118,8 +118,10 @@ ...@@ -118,8 +118,10 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ProgressBar Value="{Binding SearchProgressValue}" Width="{Binding ElementName=searchBtn, Path=ActualWidth}" Margin="{Binding ElementName=searchBtn, Path=Margin}"/> <ProgressBar Value="{Binding SearchProgressValue}" Width="{Binding ElementName=searchBtn, Path=ActualWidth}"
<Button Click="AutoSearch_Shift" x:Name="searchBtn" Margin="{Binding ElementName=searchBtn, Path=Margin}"
Grid.ColumnSpan="2"/>
<Button Click="AutoSearch_Shift" x:Name="searchBtn" Grid.ColumnSpan="2"
IsEnabled="{Binding SearchEnabled}" Width="160" IsEnabled="{Binding SearchEnabled}" Width="160"
Opacity="0.8" > Opacity="0.8" >
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
...@@ -127,12 +129,6 @@ ...@@ -127,12 +129,6 @@
<TextBlock Text="搜索最大相关度" HorizontalAlignment="Center" Margin="0,0,8,0" /> <TextBlock Text="搜索最大相关度" HorizontalAlignment="Center" Margin="0,0,8,0" />
</StackPanel> </StackPanel>
</Button> </Button>
<Button Click="AutoCal_Shift" Grid.Column="1" Width="105">
<StackPanel Orientation="Horizontal">
<iconPacks:PackIconFontAwesome Kind="RobotSolid" VerticalAlignment="Center" Margin="5,0,5,0" />
<TextBlock Text="自动计算" HorizontalAlignment="Center" Margin="0,0,8,0" />
</StackPanel>
</Button>
</Grid> </Grid>
</Grid> </Grid>
<Grid DockPanel.Dock="Top"> <Grid DockPanel.Dock="Top">
......
...@@ -18,6 +18,7 @@ using MathNet.Numerics.LinearAlgebra; ...@@ -18,6 +18,7 @@ using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using LiveCharts.Wpf; using LiveCharts.Wpf;
using System.Globalization; using System.Globalization;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule namespace FLY.HeatingHelper.UI.UiModule
{ {
...@@ -26,14 +27,19 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -26,14 +27,19 @@ namespace FLY.HeatingHelper.UI.UiModule
/// </summary> /// </summary>
public partial class UC_AirRingShift : UserControl public partial class UC_AirRingShift : UserControl
{ {
public UC_AirRingShiftViewModel mainVM = new UC_AirRingShiftViewModel(); public UC_AirRingShiftViewModel mainVM;
public UC_AirRingShift() public UC_AirRingShift()
{ {
InitializeComponent(); InitializeComponent();
} }
public void Init(object dat) private IUnityContainer container;
[InjectionMethod]
public void Initialize(IUnityContainer container,IThickHeatData dat)
{ {
this.container = container;
mainVM = container.Resolve<UC_AirRingShiftViewModel>();
mainVM.Init(dat); mainVM.Init(dat);
FP_select1.DataContext = mainVM.vm1; FP_select1.DataContext = mainVM.vm1;
...@@ -96,9 +102,23 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -96,9 +102,23 @@ namespace FLY.HeatingHelper.UI.UiModule
public class UC_AirRingShiftViewModel:INotifyPropertyChanged public class UC_AirRingShiftViewModel:INotifyPropertyChanged
{ {
[InjectionMethod]
public void Initilize(FLY.Thick.Blowing.IService.IBlowingService blowingService,
FLY.Thick.Blowing.IService.IBlowingDetectService blowingDetectService)
{
blowing = blowingService;
bDetect = blowingDetectService;
}
FLY.Thick.Blowing.IService.IBlowingService blowing;
FLY.Thick.Blowing.IService.IBlowingDetectService bDetect;
public UC_FramePickerViewModel vm1 = new UC_FramePickerViewModel(); public UC_FramePickerViewModel vm1 = new UC_FramePickerViewModel();
public UC_FramePickerViewModel vm2 = new UC_FramePickerViewModel(); public UC_FramePickerViewModel vm2 = new UC_FramePickerViewModel();
public int CurrentResetBolt { get; set; }
public double CurrentAngle { get; set; }
public int LockFrames { get; set; } = 1; public int LockFrames { get; set; } = 1;
public bool LockAngle { get; set; } = true; public bool LockAngle { get; set; } = true;
...@@ -188,6 +208,10 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -188,6 +208,10 @@ namespace FLY.HeatingHelper.UI.UiModule
{ {
//var tmpVM = ViewModel_HeatDetector.Instance; //var tmpVM = ViewModel_HeatDetector.Instance;
//tmpVM.PropertyChanged += DataSelecter_PropertyChanged; //tmpVM.PropertyChanged += DataSelecter_PropertyChanged;
//CurrentAngle = bDetect.Angle;
CurrentAngle = bDetect.RAngle;
CurrentResetBolt = blowing.OrgBoltNo;
vm1.OnLoaded(true); vm1.OnLoaded(true);
vm2.OnLoaded(); vm2.OnLoaded();
UpdateData(1); UpdateData(1);
......
...@@ -12,6 +12,7 @@ using System.Windows.Media; ...@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule namespace FLY.HeatingHelper.UI.UiModule
{ {
...@@ -26,11 +27,12 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -26,11 +27,12 @@ namespace FLY.HeatingHelper.UI.UiModule
} }
UC_HeatBoltAnalystViewModel vm; UC_HeatBoltAnalystViewModel vm;
public void Init(object dat) [InjectionMethod]
public void Init(IUnityContainer container)
{ {
vm = new UC_HeatBoltAnalystViewModel(dat as IThickHeatData); //vm = new UC_HeatBoltAnalystViewModel(dat as IThickHeatData);
vm.Loaded(dat); //vm.Loaded(dat);
vm = container.Resolve<UC_HeatBoltAnalystViewModel>();
DataContext = vm; DataContext = vm;
} }
......
...@@ -18,6 +18,8 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -18,6 +18,8 @@ namespace FLY.HeatingHelper.UI.UiModule
public UC_HeatBoltAnalystViewModel(IThickHeatData thickHeatData) public UC_HeatBoltAnalystViewModel(IThickHeatData thickHeatData)
{ {
mdata = thickHeatData; mdata = thickHeatData;
vm1.InitData(mdata);
vm2.InitData(mdata);
} }
/// <summary> /// <summary>
...@@ -82,8 +84,8 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -82,8 +84,8 @@ namespace FLY.HeatingHelper.UI.UiModule
public void Loaded(object s) public void Loaded(object s)
{ {
vm1.InitData(mdata); vm1.OnLoaded(true);
vm2.InitData(mdata); vm2.OnLoaded();
vmDiff.Init(mdata); vmDiff.Init(mdata);
} }
......
...@@ -13,6 +13,7 @@ using System.Windows.Media; ...@@ -13,6 +13,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
{ {
...@@ -24,7 +25,13 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData ...@@ -24,7 +25,13 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
public UC_SelectData() public UC_SelectData()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new ViewModel_UC_SelectData(DataManager.GetThickDataInstance()); }
[InjectionMethod]
public void Init(IUnityContainer container,IThickHeatData dat)
{
DataContext = container.Resolve<ViewModel_UC_SelectData>();
//this.DataContext = new ViewModel_UC_SelectData(DataManager.GetThickDataInstance());
} }
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
......
...@@ -22,6 +22,11 @@ namespace FLY.HeatingHelper ...@@ -22,6 +22,11 @@ namespace FLY.HeatingHelper
DBName = null; DBName = null;
} }
public ThickHeatData(string dbname)
{
SetDB(dbname);
}
private void SetDB(string dbname) private void SetDB(string dbname)
{ {
if (DBName == dbname) return; if (DBName == dbname) return;
...@@ -1546,12 +1551,4 @@ namespace FLY.HeatingHelper ...@@ -1546,12 +1551,4 @@ namespace FLY.HeatingHelper
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
} }
public class DataManager
{
public static IThickHeatData GetThickDataInstance()
{
//return ThickHeatData4SQLite_V1.Instance;
return ThickHeatData4SQLite_V2.Instance;
}
}
} }
...@@ -12,18 +12,12 @@ namespace FLY.HeatingHelper ...@@ -12,18 +12,12 @@ namespace FLY.HeatingHelper
{ {
class ThickHeatData4SQLite_V2 : ThickHeatData class ThickHeatData4SQLite_V2 : ThickHeatData
{ {
#region constructor
#region 单例模式 public ThickHeatData4SQLite_V2() : base() { }
static ThickHeatData4SQLite_V2() public ThickHeatData4SQLite_V2(string dbname)
:base(dbname)
{ {
} }
private ThickHeatData4SQLite_V2() : base()
{
DBName = null;
}
public static ThickHeatData4SQLite_V2 Instance { get; } = new ThickHeatData4SQLite_V2();
#endregion #endregion
#region 数据库接口 #region 数据库接口
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment