コード例 #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();
     }
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: trevor34/AVSHull
        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();
                }
            }
        }
コード例 #3
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();
        }
コード例 #4
0
        public void openClick(object sender, RoutedEventArgs e)
        {
            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);

                    // Make sure we have a timestamp
                    if (tempHull.Timestamp == DateTime.MinValue)
                    {
                        tempHull.Timestamp = DateTime.Now;
                    }

                    BaseHull.Instance().Bulkheads = tempHull.Bulkheads;

                    undoLog.Clear();
                    undoLog.Add(BaseHull.Instance());

                    redoLog.Clear();

                    PerspectiveView.Perspective = HullControl.PerspectiveType.PERSPECTIVE;
                    UpdateViews();
                }
            }
        }
コード例 #5
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();
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: trevor34/AVSHull
        //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;
        }