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

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

parent c5fb85fb
......@@ -206,6 +206,10 @@
<None Include="App.config" />
</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">
<Project>{5BBE76F5-CFD7-4DFA-9EE5-0C47D77D96E6}</Project>
<Name>MultiLayout</Name>
......
......@@ -29,9 +29,15 @@ namespace FLY.HeatingHelper.UI.UiModule
public HeatThickDetector()
{
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;
}
......@@ -44,7 +50,7 @@ namespace FLY.HeatingHelper.UI.UiModule
if(vm._dat.BeginUse())
{
Page_HeatDetector page = new Page_HeatDetector();
page.InitData(vm._dat);
container.BuildUp(page);
ns.Navigate(page);
}
}
......@@ -62,7 +68,10 @@ namespace FLY.HeatingHelper.UI.UiModule
public FrameworkElement GetComponent(int id,IUnityContainer container)
{
return container.Resolve<HeatThickDetector>();
//HeatThickDetector fe = new HeatThickDetector();
//IThickHeatData dat = container.Resolve<IThickHeatData>();
//fe.Init(container, dat);
//return fe;
}
......
......@@ -173,7 +173,7 @@
</StackPanel >
<TabControl Name="tc1" Style="{DynamicResource TabControlStyle_ABC}" >
<TabItem Header="数据选择" Style="{DynamicResource TabItemStyle1}">
<local1:UC_SelectData/>
<local1:UC_SelectData x:Name="uc_SelectData"/>
</TabItem>
<TabItem Header="风环偏转" Style="{DynamicResource TabItemStyle1}" x:Name="tabitem_ringShift">
<local:UC_AirRingShift x:Name="uc_airRingShift">
......
......@@ -20,6 +20,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using FLY.HeatingHelper;
using System.Threading.Tasks;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule
{
......@@ -36,16 +37,25 @@ namespace FLY.HeatingHelper.UI.UiModule
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 void InitData(object dat)
public void InitData()
{
//_vm = ViewModel_HeatDetector.Instance;
//_vm.SetData(dat as IThickHeatData);
//this.DataContext = _vm;
Dat = dat as IThickHeatData;
uc_airRingShift.Init(dat);
uc_heatBoltAnalyst.Init(dat);
}
private void button_back_Click(object sender, RoutedEventArgs e)
......
......@@ -118,8 +118,10 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ProgressBar Value="{Binding SearchProgressValue}" Width="{Binding ElementName=searchBtn, Path=ActualWidth}" Margin="{Binding ElementName=searchBtn, Path=Margin}"/>
<Button Click="AutoSearch_Shift" x:Name="searchBtn"
<ProgressBar Value="{Binding SearchProgressValue}" Width="{Binding ElementName=searchBtn, Path=ActualWidth}"
Margin="{Binding ElementName=searchBtn, Path=Margin}"
Grid.ColumnSpan="2"/>
<Button Click="AutoSearch_Shift" x:Name="searchBtn" Grid.ColumnSpan="2"
IsEnabled="{Binding SearchEnabled}" Width="160"
Opacity="0.8" >
<StackPanel Orientation="Horizontal">
......@@ -127,12 +129,6 @@
<TextBlock Text="搜索最大相关度" HorizontalAlignment="Center" Margin="0,0,8,0" />
</StackPanel>
</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 DockPanel.Dock="Top">
......
......@@ -18,6 +18,7 @@ using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using LiveCharts.Wpf;
using System.Globalization;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule
{
......@@ -26,14 +27,19 @@ namespace FLY.HeatingHelper.UI.UiModule
/// </summary>
public partial class UC_AirRingShift : UserControl
{
public UC_AirRingShiftViewModel mainVM = new UC_AirRingShiftViewModel();
public UC_AirRingShiftViewModel mainVM;
public UC_AirRingShift()
{
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);
FP_select1.DataContext = mainVM.vm1;
......@@ -96,9 +102,23 @@ namespace FLY.HeatingHelper.UI.UiModule
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 vm2 = new UC_FramePickerViewModel();
public int CurrentResetBolt { get; set; }
public double CurrentAngle { get; set; }
public int LockFrames { get; set; } = 1;
public bool LockAngle { get; set; } = true;
......@@ -188,6 +208,10 @@ namespace FLY.HeatingHelper.UI.UiModule
{
//var tmpVM = ViewModel_HeatDetector.Instance;
//tmpVM.PropertyChanged += DataSelecter_PropertyChanged;
//CurrentAngle = bDetect.Angle;
CurrentAngle = bDetect.RAngle;
CurrentResetBolt = blowing.OrgBoltNo;
vm1.OnLoaded(true);
vm2.OnLoaded();
UpdateData(1);
......
......@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule
{
......@@ -26,11 +27,12 @@ namespace FLY.HeatingHelper.UI.UiModule
}
UC_HeatBoltAnalystViewModel vm;
public void Init(object dat)
[InjectionMethod]
public void Init(IUnityContainer container)
{
vm = new UC_HeatBoltAnalystViewModel(dat as IThickHeatData);
vm.Loaded(dat);
//vm = new UC_HeatBoltAnalystViewModel(dat as IThickHeatData);
//vm.Loaded(dat);
vm = container.Resolve<UC_HeatBoltAnalystViewModel>();
DataContext = vm;
}
......
......@@ -18,6 +18,8 @@ namespace FLY.HeatingHelper.UI.UiModule
public UC_HeatBoltAnalystViewModel(IThickHeatData thickHeatData)
{
mdata = thickHeatData;
vm1.InitData(mdata);
vm2.InitData(mdata);
}
/// <summary>
......@@ -82,8 +84,8 @@ namespace FLY.HeatingHelper.UI.UiModule
public void Loaded(object s)
{
vm1.InitData(mdata);
vm2.InitData(mdata);
vm1.OnLoaded(true);
vm2.OnLoaded();
vmDiff.Init(mdata);
}
......
......@@ -13,6 +13,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Unity;
namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
{
......@@ -24,7 +25,13 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
public UC_SelectData()
{
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)
......
......@@ -22,6 +22,11 @@ namespace FLY.HeatingHelper
DBName = null;
}
public ThickHeatData(string dbname)
{
SetDB(dbname);
}
private void SetDB(string dbname)
{
if (DBName == dbname) return;
......@@ -1546,12 +1551,4 @@ namespace FLY.HeatingHelper
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
{
class ThickHeatData4SQLite_V2 : ThickHeatData
{
#region 单例模式
static ThickHeatData4SQLite_V2()
#region constructor
public ThickHeatData4SQLite_V2() : base() { }
public ThickHeatData4SQLite_V2(string dbname)
:base(dbname)
{
}
private ThickHeatData4SQLite_V2() : base()
{
DBName = null;
}
public static ThickHeatData4SQLite_V2 Instance { get; } = new ThickHeatData4SQLite_V2();
#endregion
#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