Ejemplo n.º 1
0
        /// <summary>
        /// Load the model from the underlying text buffer.
        /// </summary>
        internal void LoadModelFromXmlModel(OpenedFile file, Stream stream)
        {
            try
            {
                //var document = GetParseTree();
                var serializer = new OpenedFileSerializer(file);
                var document   = serializer.Parse(stream);
                LoadModelFromXmlModel(document);
            }
            catch (Exception e)
            {
                //Display error message
                MessageService.ShowHandledException(e, string.Format("Invalid document format: {0}", e.Message));
            }

            BufferDirty = false;

            // Update designer view
            OnViewModelChanged();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is called when it is time to save the designer values to the
        /// underlying buffer.
        /// </summary>
        /// <param name="undoEntry"></param>
        internal void SaveModelToXmlModel(OpenedFile file, Stream stream)
        {
            try
            {
                var documentFromDesignerState = SaveModelToXmlModel();

                // Wrap the buffer sync and the formatting in one undo unit.
                var serializer = new OpenedFileSerializer(file);
                serializer.Save(documentFromDesignerState, stream);
                DesignerDirty = false;
            }
            catch (Exception)
            {
                // if the synchronization fails then we'll just try again in a second.
                dirtyTime = Environment.TickCount;
            }
            finally
            {
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This method is called when it is time to save the designer values to the
        /// underlying buffer.
        /// </summary>
        /// <param name="undoEntry"></param>
        internal void SaveModelToXmlModel(OpenedFile file, Stream stream)
        {
            try
            {
                var documentFromDesignerState = SaveModelToXmlModel();

                // Wrap the buffer sync and the formatting in one undo unit.
                var serializer = new OpenedFileSerializer(file);
                serializer.Save(documentFromDesignerState, stream);
                DesignerDirty = false;
            }
            catch (Exception)
            {
                // if the synchronization fails then we'll just try again in a second.
                dirtyTime = Environment.TickCount;
            }
            finally
            {
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Load the model from the underlying text buffer.
        /// </summary>
        internal void LoadModelFromXmlModel(OpenedFile file, Stream stream)
        {
            try
            {
                //var document = GetParseTree();
                var serializer = new OpenedFileSerializer(file);
                var document = serializer.Parse(stream);
                LoadModelFromXmlModel(document);
            }
            catch (Exception e)
            {
                //Display error message
                MessageService.ShowHandledException(e, string.Format("Invalid document format: {0}", e.Message));
            }

            BufferDirty = false;

            // Update designer view
            OnViewModelChanged();
        }