Table of Contents

Property IsSmartDiffCodeSerializationRequired

Namespace
Alternet.FormDesigner.WinForms
Assembly
Alternet.FormDesigner.v9.dll

IsSmartDiffCodeSerializationRequired

Gets or sets method used to identify whether FormDesignerControl content should be saved only by taking into account code difference.

[Browsable(false)]
public Func<IFormDesignerControl, bool> IsSmartDiffCodeSerializationRequired { get; set; }

Property Value

Func<IFormDesignerControl, bool>

Examples

Here is how to use a IsSmartDiffCodeSerializationRequired in the C# code:

using Alternet.Editor.TextSource;
using Alternet.FormDesigner.WinForms;

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var formDesigner = new FormDesignerControl();
        formDesigner.AutoSaveToSource = false;
        formDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
        formDesigner.Parent = this;
        formDesigner.IsSmartDiffCodeSerializationRequired = d => ((ITextSource)((EditorFormDesignerDataSource)d.Source).DesignerTextSource).Edits.Any();
    }
}

Here is how to use a IsSmartDiffCodeSerializationRequired in the Visual Basic code:

Imports System
Imports Alternet.Editor.TextSource
Imports Alternet.FormDesigner.WinForms

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim formDesigner = New FormDesignerControl()
        formDesigner.AutoSaveToSource = False
        formDesigner.Dock = System.Windows.Forms.DockStyle.Fill
        formDesigner.Parent = Me
        formDesigner.IsSmartDiffCodeSerializationRequired = Function(d) (CType((CType(d.Source, EditorFormDesignerDataSource)).DesignerTextSource, ITextSource)).Edits.Any()
    End Sub
End Class

Remarks

When the Form Designer's content is changed and AutoSaveToSource is true, Form Designer attempts to save its content to the source automatically. IsSmartDiffCodeSerializationRequired allows you to specify whether the designer should translate a list of changes to the underlying source file rather than the entire content. This is particularly useful when the source of the designed form is displayed in the code editor, making changed lines clearly marked.