Пример #1
0
		private void _openSchemaButton_Click(Object sender, EventArgs e)
		{
			if (_openFileDialog.ShowDialog() == DialogResult.OK)
			{
				Canvas newCanvas = new Canvas();

				try
				{
					newCanvas.OpenSchema(_openFileDialog.FileName);
					AddCanvas(newCanvas);
					newCanvas.ParentTabPage.Text = _openFileDialog.SafeFileName;
					newCanvas.Path = _openFileDialog.FileName;
					SetCanvasTitle(newCanvas);
				}
				catch (Exception ex)
				{
					Log(ex.Message);
				}
			}
		}
Пример #2
0
        /*
		 * AddTabPage
		 */

        /// <summary>
        /// </summary>
        /// <exception cref="ArgumentNullException">
        /// <para>
        ///		<paramref name="pageContent"/> is <see langword="null"/>.
        /// </para>
        /// -or-
        /// <para>
        ///		<paramref name="text"/> is <see langword="null"/>.
        /// </para>
        /// </exception>
        public NuGenTabPage AddTabPage(Canvas canvas, String text, Image tabButtonImage)
        {
            if (canvas == null)
            {
                throw new ArgumentNullException("canvas");
            }

            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            NuGenTabPage tabPage = TabPages.Add(text, tabButtonImage);
            tabPage.Controls.Add(canvas);
			canvas.ParentTabPage = tabPage;
            return tabPage;
        }
Пример #3
0
		private void _diagramFromExpressionButton_Click(Object sender, EventArgs e)
		{
			Canvas activeCanvas = _tabbedMdi.ActiveCanvas;

			if (activeCanvas == null)
			{
				activeCanvas = new Canvas();
				AddCanvas(activeCanvas);
			}

			try
			{
				ExpressionSchemaBuilder.BuildSchema(ServiceProvider, activeCanvas, Expression);
				AddExpressionToHistory(Expression);
			}
			catch (ArgumentException argEx)
			{
				Log(argEx.Message);
			}
			catch (ExpressionSyntaxException expressionEx)
			{
				Log(expressionEx.Message);
			}
		}
Пример #4
0
		private void _newSchemaButton_Click(Object sender, EventArgs e)
		{
			Canvas canvas = new Canvas();
			AddCanvas(canvas);
			canvas.SaveIsNeeded = true;
		}
Пример #5
0
		private void SaveSchema(Canvas canvas)
		{
			Debug.Assert(canvas != null, "canvas != null");

			if (!canvas.SaveIsNeeded)
			{
				return;
			}

			String path = canvas.Path;

			if (String.IsNullOrEmpty(path) || !File.Exists(path))
			{
				if (_saveFileDialog.ShowDialog() == DialogResult.OK)
				{
					try
					{
						canvas.SaveSchema(_saveFileDialog.FileName);
						canvas.Path = _saveFileDialog.FileName;
						SetCanvasTitle(canvas);
					}
					catch (Exception ex)
					{
						Log(ex.Message);
					}
				}
			}
			else
			{
				canvas.SaveSchema(path);
				SetCanvasTitle(canvas);
			}
		}
Пример #6
0
		private void SetCanvasTitle(Canvas canvas)
		{
			String defaultText = Resources.Text_Expression;
			String formatString = "{0}";
			String path = canvas.Path;

			if (!String.IsNullOrEmpty(path))
			{
				defaultText = Path.GetFileName(path);
			}

			if (canvas.SaveIsNeeded)
			{
				formatString = "*{0}";
			}

			canvas.ParentTabPage.Text = String.Format(formatString, defaultText);
		}
Пример #7
0
		private NuGenTabPage AddCanvas(Canvas canvasToAdd)
		{
			Debug.Assert(canvasToAdd != null, "canvasToAdd != null");

			canvasToAdd.MouseDown += _canvas_MouseDown;
			canvasToAdd.SaveIsNeededChanged += _canvas_SaveIsNeededChanged;
			canvasToAdd.Dock = DockStyle.Fill;

			return _tabbedMdi.AddTabPage(canvasToAdd, Resources.Text_Expression, Resources.Blank);
		}
Пример #8
0
		public void AddDocument(Canvas canvas)
		{
			NuGenTreeNode treeNode = new NuGenTreeNode(canvas.ParentTabPage.Text, true, true);
			treeNode.Tag = canvas;
			_documents.Nodes.Add(treeNode);
		}
		public MdiTabCloseEventArgs(Canvas canvas)
		{
			_canvas = canvas;
		}