Exemplo n.º 1
0
        //public void MoveUp(PressItemControl pressItemControl, PressWeekControl pressWeekControl)
        //{
        //    if (pressWeekControl == _weekControls[0])
        //    {
        //        DateTime prevTime = _weekControls[0].Week.AddDays(-7);
        //        _weekControls.Insert(0,new PressWeekControl(prevTime,this));
        //        _weekControls[0].AddItemToBottom(pressItemControl);
        //        pressWeekControl.RemoveItem(pressItemControl);
        //    }
        //    else
        //    {
        //        Int32 index = _weekControls.IndexOf(pressWeekControl);

        //        _weekControls[index - 1].AddItemToBottom(pressItemControl);
        //        pressWeekControl.RemoveItem(pressItemControl);
        //    }
        //}

        //public void MoveDown(PressItemControl pressItemControl, PressWeekControl pressWeekControl)
        //{
        //    if (pressWeekControl == _weekControls.Last())
        //    {
        //        DateTime prevTime = _weekControls.Last().Week.AddDays(7);
        //        _weekControls.Add(new PressWeekControl(prevTime, this));
        //        _weekControls.Last().AddItemToTop(pressItemControl);
        //        pressWeekControl.RemoveItem(pressItemControl);
        //    }
        //    else
        //    {
        //        Int32 index = _weekControls.IndexOf(pressWeekControl);

        //        _weekControls[index + 1].AddItemToTop(pressItemControl);
        //        pressWeekControl.RemoveItem(pressItemControl);
        //    }

        //}

        private void SaveMenuItem_OnClick(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            if (saveFileDialog.ShowDialog() == true)
            {
                PressManager.Save(saveFileDialog.FileName);
            }
        }
Exemplo n.º 2
0
 public PressScheduleWindow()
 {
     InitializeComponent();
     PressManager.Window = this;
     PressManager.Load();
     foreach (var plateConfiguration in PressManager.PlateConfigurations)
     {
         WeekControls.Add(new PressPlateConfigurationControl(plateConfiguration));
     }
     DataContext = this;
 }
Exemplo n.º 3
0
        //  private void Save(string fileName)
        //  {
        //      try
        //      {
        //          using (BinaryWriter writer = new BinaryWriter(new FileStream(fileName, FileMode.OpenOrCreate)))
        //          {
        //              writer.Write(WeekControls.Count);
        //              foreach (var pressWeekControl in WeekControls)
        //              {
        ////                  pressWeekControl.Save(writer);
        //              }
        //          }
        //      }
        //      catch (Exception)
        //      {
        //          MessageBox.Show("Save failed.");
        //      }
        //  }

        private void LoadMenuItem_OnClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Multiselect = false
            };
            var result = openFileDialog.ShowDialog();

            if (result == true)
            {
                PressManager.Load();
                WeekControls.Clear();
                foreach (var plateConfiguration in PressManager.PlateConfigurations)
                {
                    WeekControls.Add(new PressPlateConfigurationControl(plateConfiguration));
                }
            }
        }
        void PressSettingsWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var result = MessageBox.Show("Would you like to save any changes?", "", MessageBoxButton.YesNoCancel);

            if (result ==
                MessageBoxResult.Yes)
            {
                if (PressManager.Save())
                {
                    MessageBox.Show("Save successful");
                }
                else
                {
                    MessageBox.Show("There was an issue saving.");
                }
            }
            else if (result == MessageBoxResult.Cancel)
            {
                e.Cancel = true;
            }
        }