Example #1
0
 public void Close()
 {
     if (DocumentOwner != null)
     {
         DocumentOwner.Close(this);
     }
 }
        /// <summary> Default constructor. </summary>
        public DocumentEditorContext(DocumentOwner owner)
        {
            Document = owner;

            var cursor = ((ContentBlock)Document.Root.FirstBlock).GetCaretAtStart();

            Selection         = new DocumentSelection(Document, cursor);
            CaretMovementMode = new CaretMovementMode();

            UndoStack = new ActionStack(this, new StandardMergePolicy());
        }
Example #3
0
 /// <summary>
 /// Closes the corresponding view.
 /// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the CloseCommand property that can be used as a binding source in views.
 /// </summary>
 public void Close()
 {
     if (!TryClose())
     {
         return;
     }
     if (DocumentOwner != null)
     {
         DocumentOwner.Close(this);
     }
 }
Example #4
0
        public void Save()
        {
            var query = base.AddItem((CompanyStockholderModel)Content.Clone());

            if (query != null)
            {
                IsChange     = true;
                this.Content = query;
                DocumentOwner.Close(this, false);
                DevExpress.Xpf.Core.DXMessageBox.Show("添加成功!");
                Common.Core.LOGGER.Info(string.Format("添加CompanyStockholderModel成功,ID:{0}", query.ID));
            }
            else
            {
                DevExpress.Xpf.Core.DXMessageBox.Show("添加失败!", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                Common.Core.LOGGER.Error("添加CompanyStockholderModel失败");
            }
        }
Example #5
0
        /// <summary> Check that the two documents are equal. </summary>
        private static void CheckEqual(DocumentOwner originalState, DocumentOwner currentState)
        {
            var originalJson = JsonConvert.SerializeObject(originalState.SerializeAsNode(), Formatting.Indented);
            var newJson      = JsonConvert.SerializeObject(currentState.SerializeAsNode(), Formatting.Indented);

            if (originalState.Equals(currentState))
            {
                DidYouKnow.That(newJson).Should().Be(originalJson);
                return;
            }

            Console.WriteLine("===== Original State: =====");
            Console.WriteLine(originalJson);
            Console.WriteLine("===== Current State: =====");
            Console.WriteLine(newJson);

            FindDifference(currentState.SerializeAsNode(), originalState.SerializeAsNode(), "");
        }
Example #6
0
        public Block Get(DocumentOwner owner)
        {
            if (_ids == null)
            {
                return(null);
            }

            BlockCollection collection = owner.Root;
            Block           block      = null;

            for (int i = _ids.Length - 1; i >= 0; i--)
            {
                int blockIndex = _ids[0];

                Debug.Assert(collection != null);
                block      = collection.GetNthBlock(blockIndex);
                collection = block as BlockCollection;
            }

            return(block);
        }
Example #7
0
        public void DocLoaded(object obj)
        {
            if (this.Content == null)
            {
                return;
            }
            try
            {
                var sp = (DevExpress.Xpf.Spreadsheet.SpreadsheetControl)obj;
                sp.BeginUpdate();
                var workbook  = (sp).Document;
                var workSheet = workbook.Worksheets[0];
                DevExpress.Spreadsheet.Range rang;
                rang = workSheet.Range["B8:Y8"];
                SetCellValue(rang, this.Content.Sheet1);

                workSheet = workbook.Worksheets[1];
                rang      = workSheet.Range["B8:T8"];
                SetCellValue(rang, this.Content.Sheet2);

                workSheet = workbook.Worksheets[2];
                rang      = workSheet.Range["B8:L8"];
                SetCellValue(rang, this.Content.Sheet3);


                workSheet = workbook.Worksheets[3];
                rang      = workSheet.Range["B8:J8"];
                SetCellValue(rang, this.Content.Sheet4);

                sp.EndUpdate();
            }
            catch (Exception)
            {
                DocumentOwner.Close(this, false);
                //throw new Exception("月报表数据不完整。请联系管理员。");
                throw new Helpers.ReportException("月报表数据不完整。请联系管理员。");
            }
        }
Example #8
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Identification != null ? Identification.ToStepValue() : "$");
            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(Location != null ? Location.ToStepValue() : "$");
            parameters.Add(Purpose != null ? Purpose.ToStepValue() : "$");
            parameters.Add(IntendedUse != null ? IntendedUse.ToStepValue() : "$");
            parameters.Add(Scope != null ? Scope.ToStepValue() : "$");
            parameters.Add(Revision != null ? Revision.ToStepValue() : "$");
            parameters.Add(DocumentOwner != null ? DocumentOwner.ToStepValue() : "$");
            parameters.Add(Editors != null ? Editors.ToStepValue() : "$");
            parameters.Add(CreationTime != null ? CreationTime.ToStepValue() : "$");
            parameters.Add(LastRevisionTime != null ? LastRevisionTime.ToStepValue() : "$");
            parameters.Add(ElectronicFormat != null ? ElectronicFormat.ToStepValue() : "$");
            parameters.Add(ValidFrom != null ? ValidFrom.ToStepValue() : "$");
            parameters.Add(ValidUntil != null ? ValidUntil.ToStepValue() : "$");
            parameters.Add(Confidentiality.ToStepValue());
            parameters.Add(Status.ToStepValue());

            return(string.Join(", ", parameters.ToArray()));
        }
        public bool Close()
        {
            MessageResult result = MessageResult.Yes;

            if (Modified)
            {
                if (MessageBoxService != null)
                {
                    result = MessageBoxService.Show("Do you want to save changes?", "Mail Merge",
                                                    MessageButton.YesNoCancel,
                                                    MessageIcon.Question,
                                                    MessageResult.Yes);
                    if (result == MessageResult.Yes)
                    {
                        RaiseSave();
                    }
                }
            }
            if (result != MessageResult.Cancel && DocumentOwner != null)
            {
                DocumentOwner.Close(this);
            }
            return(result != MessageResult.Cancel);
        }
 /// <inheritdoc />
 public override IEnumerable <IContextualCommand> GetCommands(DocumentOwner document)
 {
     yield break;
 }
 /// <summary> Constructor. </summary>
 /// <param name="owner"> The Document that owns the given cursor. </param>
 /// <param name="blockCaret"> The block cursor. </param>
 public DocumentSelection(DocumentOwner owner, BlockCaret blockCaret)
 {
     Owner = owner;
     MoveTo(blockCaret, SelectionMode.Replace);
 }
 public TestHelper(ArchiveClient archiveClient)
 {
     _archiveClient = archiveClient;
     _documentOwner = new DocumentOwner(_archiveClient.ClientConfiguration.GlobalSender.OrganizationNumber);
     _document      = new ArchivedDocumentId("1234");
 }
Example #13
0
 public void Save()
 {
     //检查 正确这close
     this.IsSaved = true;
     DocumentOwner.Close(this, false);
 }
Example #14
0
 /// <summary> All of the commands that should be available when the block is in a document. </summary>
 /// <param name="document"></param>
 public abstract IEnumerable <IContextualCommand> GetCommands(DocumentOwner document);
Example #15
0
        public void DocLoaded(object obj)
        {
            if (this.Content == null)
            {
                return;
            }
            try
            {
                var sp = (DevExpress.Xpf.Spreadsheet.SpreadsheetControl)obj;
                sp.BeginUpdate();
                var workbook  = (sp).Document;
                var workSheet = workbook.Worksheets[0];
                DevExpress.Spreadsheet.Range rang;
                bool IsCompany = false;
                if (this.Content.Sheet1.Mark == "公司制")
                {
                    IsCompany = true;
                }

                if (IsCompany)
                {
                    rang = workSheet.Range["E11:E35"];
                }
                else
                {
                    rang = workSheet.Range["F11:F35"];
                }
                SetCellValue_Column(rang, this.Content.Sheet1);


                workSheet = workbook.Worksheets[1];
                if (IsCompany)
                {
                    rang = workSheet.Range["D10:D32"];
                }
                else
                {
                    rang = workSheet.Range["E10:E32"];
                }
                SetCellValue_Column(rang, this.Content.Sheet2);

                workSheet = workbook.Worksheets[2];
                if (IsCompany)
                {
                    rang = workSheet.Range["C10:C27"];
                }
                else
                {
                    rang = workSheet.Range["D10:D27"];
                }
                SetCellValue_Column(rang, this.Content.Sheet3);

                workSheet = workbook.Worksheets[3];
                rang      = workSheet.Range["D10:G34"];
                SetCellValue_Column_Row(rang, this.Content.Sheet4);

                workSheet = workbook.Worksheets[4];
                rang      = workSheet.Range["D10:F34"];
                SetCellValue_Column_Row(rang, this.Content.Sheet5);

                workSheet = workbook.Worksheets[5];
                rang      = workSheet.Range["B8:M8"];
                SetCellValue(rang, this.Content.Sheet6);

                workSheet = workbook.Worksheets[6];
                rang      = workSheet.Range["B7:O7"];
                SetCellValue(rang, this.Content.Sheet7);

                sp.EndUpdate();
            }
            catch (Exception)
            {
                DocumentOwner.Close(this, false);
                //throw new Exception("年报表数据不完整。请联系管理员。");
                throw new Helpers.ReportException("年报表数据不完整。请联系管理员。");
            }
        }
Example #16
0
 public void Close()
 {
     DocumentOwner.Close(this, false);
 }
 /// <param name="document"></param>
 /// <inheritdoc/>
 public override IEnumerable <IContextualCommand> GetCommands(DocumentOwner document)
 {
     yield return(new ConvertParagraphCommand());
 }