コード例 #1
0
        protected BinaryCapsule(SerializationInfo info, StreamingContext context)
        {
            try
            {
                this.mBinaryAmbiance = info.GetValue("mBinaryAmbiance", typeof(BinaryAmbiance)) as BinaryAmbiance;
            }
            catch (Exception exc)
            {
                Trace.WriteLine(exc.Message, "BinaryCapsule.DeserializationConstructor");
                //trying to recover the old binaries
                this.mBinaryAmbiance = info.GetValue("mBinaryAmbience", typeof(BinaryAmbiance)) as BinaryAmbiance;
            }
            this.mGraphAbstract = info.GetValue("mGraphAbstract", typeof(GraphAbstract)) as GraphAbstract;

            if (mGraphAbstract != null && mGraphAbstract.Layers != null)
            {
                foreach (GraphLayer tLayer in mGraphAbstract.Layers)
                {
                    if (tLayer.Name != "Default" && tLayer.Visible)
                    {
                        mGraphAbstract.ActiveLayer(tLayer.Name);
                        break;
                    }
                }

                if (mGraphAbstract.CurrentLayer == null)
                {
                    mGraphAbstract.ActiveLayer("Default");
                }
            }

            this.mThumbnail = info.GetValue("mThumbnail", typeof(Image)) as Image;
        }
コード例 #2
0
        /// <summary>
        /// Returns the ambiance of the GraphControl
        /// </summary>
        /// <param name="site"></param>
        /// <returns></returns>
        private static BinaryAmbiance GetControlAmbiance(GraphControl site)
        {
            BinaryAmbiance ambiance = new BinaryAmbiance();

            ambiance.ShowGrid = site.ShowGrid;

            ambiance.GradientBottom = site.GradientBottom;

            ambiance.GradientTop = site.GradientTop;

            ambiance.AllowAddConnection = site.AllowAddConnection;

            ambiance.AllowAddShape = site.AllowAddShape;

            ambiance.AllowDeleteShape = site.AllowDeleteShape;

            ambiance.AllowMoveShape = site.AllowMoveShape;

            ambiance.AutomataPulse = site.AutomataPulse;

            ambiance.BackgroundColor = site.BackgroundColor;

            ambiance.BackgroundImagePath = site.BackgroundImagePath;

            ambiance.BackgroundType = site.BackgroundType;

            ambiance.EnableContextMenu = site.EnableContextMenu;

            ambiance.GradientMode = site.GradientMode;

            ambiance.GridSize = site.GridSize;

            ambiance.RestrictToCanvas = site.RestrictToCanvas;

            ambiance.Snap = site.Snap;

            ambiance.DefaultConnectionPath = site.DefaultConnectionPath;

            ambiance.DefaultConnectionEnd = site.DefaultConnectionEnd;

            ambiance.EnableLayout = site.EnableLayout;

            ambiance.GraphLayoutAlgorithm = site.GraphLayoutAlgorithm;

            ambiance.Locked = site.Locked;

            ambiance.EnableTooltip = site.EnableToolTip;

            ambiance.ShowAutomataController = site.ShowAutomataController;

            return(ambiance);
        }
コード例 #3
0
		protected  BinaryCapsule(SerializationInfo info, StreamingContext context) 
		{
			try
			{
				this.mBinaryAmbiance = info.GetValue("mBinaryAmbiance", typeof(BinaryAmbiance)) as BinaryAmbiance;
			}
			catch(Exception exc)
			{
				Trace.WriteLine(exc.Message, "BinaryCapsule.DeserializationConstructor");
				//trying to recover the old binaries
				this.mBinaryAmbiance = info.GetValue("mBinaryAmbience", typeof(BinaryAmbiance)) as BinaryAmbiance;
			}
			this.mGraphAbstract = info.GetValue("mGraphAbstract", typeof(GraphAbstract)) as GraphAbstract;
			this.mThumbnail = info.GetValue("mThumbnail", typeof(Image)) as Image;
		}
コード例 #4
0
 protected BinaryCapsule(SerializationInfo info, StreamingContext context)
 {
     try
     {
         this.mBinaryAmbiance = info.GetValue("mBinaryAmbiance", typeof(BinaryAmbiance)) as BinaryAmbiance;
     }
     catch (Exception exc)
     {
         Trace.WriteLine(exc.Message, "BinaryCapsule.DeserializationConstructor");
         //trying to recover the old binaries
         this.mBinaryAmbiance = info.GetValue("mBinaryAmbience", typeof(BinaryAmbiance)) as BinaryAmbiance;
     }
     this.mGraphAbstract = info.GetValue("mGraphAbstract", typeof(GraphAbstract)) as GraphAbstract;
     this.mThumbnail     = info.GetValue("mThumbnail", typeof(Image)) as Image;
 }
コード例 #5
0
        /// <summary>
        /// Sets the GraphControl's properties with the given deserialized ambiance
        /// </summary>
        /// <param name="site"></param>
        /// <param name="ambiance"></param>
        private static void SetControlAmbiance(GraphControl site, BinaryAmbiance ambiance)
        {
            site.ShowGrid = ambiance.ShowGrid;

            site.GradientTop = ambiance.GradientTop;

            site.GradientBottom = ambiance.GradientBottom;

            site.AllowAddConnection = ambiance.AllowAddConnection;

            site.AllowAddShape = ambiance.AllowAddShape;

            site.AllowDeleteShape = ambiance.AllowDeleteShape;

            site.AllowMoveShape = ambiance.AllowMoveShape;

            site.AutomataPulse = ambiance.AutomataPulse;

            site.BackgroundColor = ambiance.BackgroundColor;

            site.BackgroundImagePath = ambiance.BackgroundImagePath;

            site.BackgroundType = ambiance.BackgroundType;

            site.EnableContextMenu = ambiance.EnableContextMenu;

            site.GradientMode = ambiance.GradientMode;

            site.GridSize = ambiance.GridSize;

            site.RestrictToCanvas = ambiance.RestrictToCanvas;

            site.Snap = ambiance.Snap;

            site.DefaultConnectionPath = ambiance.DefaultConnectionPath;

            site.DefaultConnectionEnd = ambiance.DefaultConnectionEnd;

            site.EnableLayout = ambiance.EnableLayout;

            site.GraphLayoutAlgorithm = ambiance.GraphLayoutAlgorithm;

            site.EnableToolTip = ambiance.EnableTooltip;

            site.Locked = ambiance.Locked;

            site.ShowAutomataController = ambiance.ShowAutomataController;
        }
コード例 #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="graphAbstract"></param>
 /// <param name="ambiance"></param>
 public BinaryCapsule(GraphAbstract graphAbstract, BinaryAmbiance ambiance)
 {
     this.mGraphAbstract  = graphAbstract;
     this.mBinaryAmbiance = ambiance;
 }
コード例 #7
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="graphAbstract"></param>
		/// <param name="ambiance"></param>
		public BinaryCapsule(GraphAbstract graphAbstract, BinaryAmbiance ambiance)
		{
			this.mGraphAbstract = graphAbstract;
			this.mBinaryAmbiance = ambiance;
		}