예제 #1
0
        void CreatePanels()
        {
            fPLCSoftwareView = new PLCSoftwareView();
            //fPLCSoftwareView.Window = this;

            fPLCHardwareView = new PLCHardwareView();
            //fPLCHardwareView.Window = this;

            fPLCITView = new PLCITView();
            //fPLCITView.Window = this;

            //fPLCView = fPLCITView;
            //fPLCView = fPLCHardwareView;
            fPLCView = fPLCSoftwareView;
            //AddGraphic(fPLCView);
        }
예제 #2
0
		// A Basic dictionary lookup
        //EpssApi.Edition GetEdition(string name)
        //{
        //    EpssApi.Edition edition = null;


        //    if (this.fEditionsDictionary.ContainsKey(name))
        //        edition = (EpssApi.Edition)this.fEditionsDictionary.GetByIndex(fEditionsDictionary.IndexOfKey(name));

        //    return edition;
        //}

        //void MenuEditionClick(object obj, EventArgs ea)
        //{
        //    MenuItem aMenu = (MenuItem)obj;

        //    // Using the title, find the edition 
        //    EpssApi.Edition edition = GetEdition(aMenu.Text);

        //    // See if a view already exists for the edition.
        //    // If it does not, then create a view for the edition
        //    PLCView editionView = this.CreateEditionView(edition);

        //    // Display the view for the specified edition
        //    fClientPanel.SwitchToView(editionView);
        //}
		
        //void MenuChangeZoom(object obj, EventArgs ea)
        //{
        //    MenuItem aMenu = (MenuItem)obj;

        //    switch (aMenu.Text)
        //    {
        //        case "100":
        //            fScaleFactor.Width = 1;
        //            fScaleFactor.Height = 1;
        //            break;
        //        case "150":
        //            fScaleFactor.Width = 150;
        //            fScaleFactor.Height = 150;
        //            break;
        //        case "200":
        //            fScaleFactor.Width = 200;
        //            fScaleFactor.Height = 200;
        //            break;

        //    }

        //    // Draw the whole screen
        //    fClientPanel.ZoomFactor = fScaleFactor.Width;
        //    Size autoSize = new Size((int)Math.Ceiling(fScaleFactor.Width*1024),
        //        (int)Math.Ceiling(fScaleFactor.Height*768));
        //    fClientPanel.AutoScrollMinSize = autoSize;

        //    Invalidate();
        //}

        //void MenuNewClick(object obj, EventArgs ea)
        //{
        //    Console.WriteLine("MenuNewClick");
        //    //fContentBrowser = new ContentBrowser();
        //    //fContentBrowser.DisplayContent("<html><head><body>Hello World!</body></head></html>");
        //    //fContentBrowser.Show();
        //}

		/// <summary>
		/// This delegate routine is called when the 'Open' menu item is clicked.
		/// </summary>
		/// <param name="obj">A reference to the menu item that was clicked.</param>
		/// <param name="ea">The event arguments for the menu click</param>
        //void MenuOpenClick(object obj, EventArgs ea)
        //{
        //    if (fFileOpenDialog.ShowDialog() == DialogResult.OK)
        //    {
        //        fFileName = fFileOpenDialog.FileName;

        //        LoadFile(fFileName);
        //    }
        //}

        //void MenuSaveClick(object obj, EventArgs ea)
        //{
        //    Console.WriteLine("MenuSaveClick");
        //}

        //void MenuSaveAsClick(object obj, EventArgs ea)
        //{
        //    //Console.WriteLine("MenuSaveAsClick");
        //    fSaveFileDialog.AddExtension = true;
        //    fSaveFileDialog.FileName = fClientPanel.EditionName;

        //    if (fSaveFileDialog.ShowDialog() == DialogResult.OK)
        //    {
        //        this.fClientPanel.SaveAs(fSaveFileDialog.FileName);
        //    }
        //}
		

        //void MenuPageSetupClick(object obj, EventArgs ea)
        //{
        //    // Page Setup Dialog settings
        //    setupDlg.Document = printDoc;
        //    setupDlg.PageSettings = printDoc.DefaultPageSettings;
        //    setupDlg.AllowMargins = false;
        //    setupDlg.AllowOrientation = true;
        //    setupDlg.AllowPaper = true;
        //    setupDlg.AllowPrinter = true;

        //    // Now pop up the dialog and capture the settings
        //    if (setupDlg.ShowDialog() == DialogResult.OK)
        //    {
        //        printDoc.DefaultPageSettings = setupDlg.PageSettings;
        //        printDoc.PrinterSettings = setupDlg.PrinterSettings;
        //    }
        //}

        //void MenuPrintClick(object obj, EventArgs ea)
        //{
        //    printDlg.Document = printDoc;

        //    printDlg.PrinterSettings.MinimumPage = 1;
        //    printDlg.PrinterSettings.MaximumPage = 1;
        //    printDlg.PrinterSettings.FromPage = 1;
        //    printDlg.PrinterSettings.ToPage = 1;

        //    if (printDlg.ShowDialog() == DialogResult.OK)
        //    {
        //        printDoc.DocumentName = Text;
        //        printDoc.PrintPage += new PrintPageEventHandler(OnPrintPage);
				
        //        // Do the actual printing thing
        //        printDoc.Print();
        //    }
        //}
		
        //void OnPrintPage(object obj, PrintPageEventArgs ppea)
        //{
        //    // Create the graphics object to match the printer driver
        //    Graphics grfx = ppea.Graphics;
			
        //    // Now draw stuff
        //    RootGraphic.DrawInto(grfx);

        //    ppea.HasMorePages = false;
        //}



		PLCView CreateEditionView(EditionType edition)
		{
			PLCView aView = null;

			// Create a new view based on the stream of XML
			// and hand that back.
			switch (edition)
			{
                //case EditionType.Hardware:
                //    aView = new PLCHardwareView(edition.Title,0,0,WExt.X, WExt.Y);
                //    break;
				case EditionType.Software:
					aView = new PLCSoftwareView("Software",0,0,WExt.X, WExt.Y);
					break;
                //case EditionType.IT:
                //    aView = new PLCITView(edition.Title,0,0,WExt.X, WExt.Y);
                //    break;
			}

            //try {
            //    XmlNode xNode = _ws.GeneratePLCMapXml (edition.EditionId);
            //    aView.XmlData = xNode;
            //} catch 
            //{
            //    Console.WriteLine("Error in loading XML from service: {0}",edition.EditionId);
            //}

			return aView;
		}