Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainViewModel : INotifyPropertyChanged
- {
- public MainViewModel() { }
- private LoadCurrentViewModel _LoadCurrentVM;
- public LoadCurrentViewModel LoadCurrentVM { get { return _LoadCurrentVM; } set { _LoadCurrentVM = value; NotifyPropertyChanged("LoadCurrentVM"); } }
- private LoadingHistoryTopView _LoadHistoryTopActiveVM = new LoadingHistoryTopView();
- public LoadingHistoryTopView LoadHistoryTopActiveVM { get { return _LoadHistoryTopActiveVM; } set { _LoadHistoryTopActiveVM = value; NotifyPropertyChanged("LoadHistoryTopActiveVM"); } }
- private LoadCurrentViewModel _LoadCurrentViewModelData = new LoadCurrentViewModel();
- public LoadCurrentViewModel LoadCurrentViewModelData { get { return _LoadCurrentViewModelData; } set { _LoadCurrentViewModelData = value; NotifyPropertyChanged("LoadCurrentViewModelData"); } }
- public event PropertyChangedEventHandler PropertyChanged;
- public void NotifyPropertyChanged(string propName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); }
- }
- //public LoadCurrentViewModel LoadCurrentViewModelData { get; set; } = new LoadCurrentViewModel();
- LoadCurrentBetween objMain = new LoadCurrentBetween();
- LoadingHistory objLoadHistory = new LoadingHistory();
- MainViewModel _MainViewModel = new MainViewModel();
- LoadHistoryUC objLoad = new LoadHistoryUC();
- public Scanner()
- {
- DataContext = _MainViewModel;
- InitializeComponent();
- }
- private void PaintScan(object sender, RoutedEventArgs e)
- {
- //Insert Scanned values to db
- DbOperations.InsertScanHistory(_MainViewModel.LoadCurrentViewModelData.Part, Convert.ToInt32(_MainViewModel.LoadCurrentViewModelData.NoofHook), 2, _MainViewModel.LoadCurrentViewModelData.Date, _MainViewModel.LoadCurrentViewModelData.Time);
- //objLoad.PopulateHistory(objLoad);
- objLoadHistory.PopulateHistory();
- MessageBox.Show("PaintScan Done");
- }
- public partial class LoadingHistory : Window
- {
- public List<LoadingHistoryModel> LoadhistoryVM = new List<LoadingHistoryModel>();
- public LoadingHistoryTopView LoadhistorytopVM = new LoadingHistoryTopView();
- public MainViewModel _MainViewModel = new MainViewModel();
- public LoadingHistory()
- {
- InitializeComponent();
- DataContext = _MainViewModel;
- PopulateHistory();
- }
- public void PopulateHistory()
- {
- LoadhistoryVM = DbOperations.GetLoadHistory();
- if (LoadhistoryVM.Count > 0)
- {
- for (var i = 0; i < LoadhistoryVM[0].GroupPartNumbers.Count(); i++)
- {
- switch (LoadhistoryVM[0].GroupPartNumbers[i].LinePosition)
- {
- case 1:
- //LoadhistoryVM[i].IsLoaded = true;
- break;
- case 2:
- PainttopView paint = new PainttopView();
- paint.Hookno = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber;
- paint.LinePosition = LoadhistoryVM[0].GroupPartNumbers[i].LinePosition;
- paint.isEmpty = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber == 0 ? true : false;
- if (!paint.isEmpty)
- paint.ImgSource = "/Views/Image/Bluering.png";
- else
- paint.ImgSource = "/Views/Image/RedStop.png";
- _MainViewModel.LoadHistoryTopActiveVM.Paint.Add(paint);
- break;
- case 3:
- BaketopView bake = new BaketopView();
- bake.Hookno = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber;
- bake.LinePosition = LoadhistoryVM[0].GroupPartNumbers[i].LinePosition;
- bake.isEmpty = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber == 0 ? true : false;
- if (!bake.isEmpty)
- bake.ImgSource = "/Views/Image/Bluering.png";
- else
- bake.ImgSource = "/Views/Image/RedStop.png";
- _MainViewModel.LoadHistoryTopActiveVM.Bake.Add(bake);
- break;
- case 4:
- CooltopView cool = new CooltopView();
- cool.Hookno = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber;
- cool.LinePosition = LoadhistoryVM[0].GroupPartNumbers[i].LinePosition;
- cool.isEmpty = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber == 0 ? true : false;
- if (!cool.isEmpty)
- cool.ImgSource = "/Views/Image/Bluering.png";
- else
- cool.ImgSource = "/Views/Image/RedStop.png";
- _MainViewModel.LoadHistoryTopActiveVM.Cool.Add(cool);
- break;
- case 5:
- //LoadhistoryVM[i].IsUnloaded = true;
- break;
- }
- _MainViewModel.LoadHistoryTopActiveVM.Hooks.Add(LoadhistoryVM[0].GroupPartNumbers[i].HookNumber);
- if (i == 0)
- {
- _MainViewModel.LoadHistoryTopActiveVM.HookNumber = LoadhistoryVM[0].GroupPartNumbers[i].HookNumber;
- _MainViewModel.LoadHistoryTopActiveVM.LinePosition = LoadhistoryVM[0].GroupPartNumbers[i].LinePosition;
- _MainViewModel.LoadHistoryTopActiveVM.PartNumber = LoadhistoryVM[0].GroupPartNumbers[i].PartNumber;
- _MainViewModel.LoadHistoryTopActiveVM.Workorder = LoadhistoryVM[0].GroupPartNumbers[i].Workorder;
- _MainViewModel.LoadHistoryTopActiveVM.Date = LoadhistoryVM[0].GroupPartNumbers[i].Date;
- }
- }
- }
- DataContext = _MainViewModel;
- }
- }
- <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
- <Border BorderBrush="Black" BorderThickness="1" Margin="10">
- <Grid Background="White" DataContext="{Binding LoadHistoryTopActiveVM}">..........
Add Comment
Please, Sign In to add comment