Exemple #1
0
 void hull_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     Debug.WriteLine("DesignControl.PropertyChanged: " + e.PropertyName);
     if (e.PropertyName == "HullData" || e.PropertyName == "Bulkhead" || e.PropertyName == "HullScale" || e.PropertyName == "Bulkhead.Handle")
     {
         if (e.PropertyName != "Bulkhead.Handle")
         {
             undoLog.StartSnapshot();
         }
         undoLog.Add(BaseHull.Instance());
         redoLog.Clear();
         UpdateViews();
     }
 }
Exemple #2
0
 public void Undo_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (undoLog.Count > 1)
     {
         redoLog.Add(undoLog.Pop());
         BaseHull.Instance().Bulkheads = undoLog.Peek().Bulkheads;
         UpdateViews();
     }
 }
Exemple #3
0
 private void Undo_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (undoLog.Count > 1)
     {
         redoLog.Add(undoLog.Pop());
         myHull = undoLog.Peek();
         myHull.PropertyChanged += hull_PropertyChanged;
         myHull.SetBulkheadHandler();
         UpdateViews();
     }
 }
Exemple #4
0
        private void openClick(object sender, RoutedEventArgs e)
        {
            // destroy any previous hull
            myHull = null;

            OpenFileDialog openDlg = new OpenFileDialog();

            openDlg.Filter           = "AVS Hull files (*.avsh)|*.avsh|All files (*.*)|*.*";
            openDlg.FilterIndex      = 0;
            openDlg.RestoreDirectory = true;

            Nullable <bool> result = openDlg.ShowDialog();

            if (result == true)
            {
                Hull tempHull;

                System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Hull));

                using (Stream reader = new FileStream(openDlg.FileName, FileMode.Open))
                {
                    // Call the Deserialize method to restore the object's state.
                    tempHull = (Hull)serializer.Deserialize(reader);
                    myHull   = tempHull;
                    myHull.PropertyChanged += hull_PropertyChanged;
                    myHull.SetBulkheadHandler();
                    undoLog.Clear();
                    undoLog.Add(myHull);

                    redoLog.Clear();

                    PerspectiveView.perspective = HullControl.PerspectiveType.PERSPECTIVE;
                    PerspectiveView.IsEditable  = false;
                    UpdateViews();

                    PanelsMenu.IsEnabled = true;
                    NumChines.Text       = ((myHull.Bulkheads[0].NumChines) / 2).ToString();
                }
            }
        }
Exemple #5
0
        //public bool AllowBulkheadMoves;

        public MainWindow()
        {
            InitializeComponent();
            myHull = new Hull();
            myHull.PropertyChanged += hull_PropertyChanged;

            undoLog = (HullLog)this.FindResource("UndoLog");
            undoLog.Clear();
            undoLog.Add(myHull);

            redoLog = (HullLog)this.FindResource("RedoLog");
            redoLog.Clear();
        }
Exemple #6
0
        public DesignControl()
        {
            InitializeComponent();

            BaseHull.Instance().PropertyChanged += hull_PropertyChanged;

            undoLog = (HullLog)this.FindResource("UndoLog");
            undoLog.Clear();
            undoLog.Add(BaseHull.Instance());

            redoLog = (HullLog)this.FindResource("RedoLog");
            redoLog.Clear();
        }
Exemple #7
0
        //public bool AllowBulkheadMoves;

        public MainWindow()
        {
            InitializeComponent();
            myHull = new Hull();
            myHull.PropertyChanged += hull_PropertyChanged;

            undoLog = (HullLog)this.FindResource("UndoLog");
            undoLog.Clear();
            undoLog.Add(myHull);

            redoLog = (HullLog)this.FindResource("RedoLog");
            redoLog.Clear();

            this.KeyDown += new KeyEventHandler(MainWindow_KeyDown);
            this.KeyUp   += new KeyEventHandler(MainWindow_KeyUp);

            movementStopped = true;
            shifted         = false;
            ctrl            = false;
        }