VIZZARD Document Help

KIOSK Plugin 구현

예제

  1. Visual Studio 실행

  2. [클래스 라이브러리(.NET Framework)] 유형 선택

Figure 1 : 프로젝트 유형 선택

VIZZARD_DEV_KIOSK_EX01.png
    1. 이름에 "MyKIOSK" 입력 후, 확인 버튼 선택

    2. "MyKIOSK" 선택 후, 마우스 오른쪽 버튼 클릭해서 Context Menu에서 추가 선택하고 사용자 정의 컨트롤 유형 선택

    Figure 2 : 사용자 정의 컨트롤 추가

    VIZZARD_DEV_KIOSK_EX02.png
      1. 이름에 "KIOSKControl.cs" 입력 후, 추가 버튼 선택

      Figure 3 : 사용자 정의 컨트롤 추가

      VIZZARD_DEV_KIOSK_EX03.png
        1. "MyKIOSK" 프로젝트 하위의 "참조" 선택 후, 마우스 오른쪽 버튼 클릭해서 Context Menu에서 참조 추가 선택

        Figure 4 : 참조 추가

        VIZZARD_DEV_KIOSK_EX04.png
          1. "참조 관리자"의 "찾아보기" 선택 후, 찾아보기... 선택하고, VIZZARD가 설치된 폴더의 "SHConnector.dll" 선택 후, 추가

          Figure 5 : SHConnector.dll 추가

          VIZZARD_DEV_KIOSK_EX05.png
            1. Namespace 추가

            using SHConnector;
            1. Base Class 추가

            IEntryConnector
            1. VIZZARD 응용프로그램과 연결을 위한 객체 선언

            public IVIZZARDService Connector { get; set; }
            1. 생성자 재정의 (추가)

            public MyClass(IVIZZARDService conn) : this() { Connector = conn; }
            1. Plugin 자체 라이선스 체크를 위한 메서드 추가

            public bool CheckLicense(int hostApp) { return true; }
            1. DevExpress Library 추가

            Figure 6 : DevExpress.Utilis 추가

            VIZZARD_DEV_KIOSK_EX06.png

              Figure 7 : DevExpress.XtraBars, XtraEditors 추가

              VIZZARD_DEV_KIOSK_EX07.png
                1. Namespace 추가

                using DevExpress.XtraBars.Docking2010.Views.WindowsUI; using DevExpress.XtraEditors; using DevExpress.LookAndFeel;
                1. 타일 및 UI 관리를 위한 객체 정의

                // 타일 컨테이너 객체 private DevExpress.XtraBars.Docking2010.Views.WindowsUI.TileContainer windowsTileContainer; // UI View 객체 private DevExpress.XtraBars.Docking2010.Views.WindowsUI.WindowsUIView windowsUIView;
                1. KIOSK VIZCore Control 선언 추가

                // VIZCore3D UserControl public VIZViewer VIZCoreUserControl { get; set; }
                1. Touch Mode 지원 기능에서 확대 비율 커스터마이징 (필요시 정의)

                public KIOSKControl() { InitializeComponent(); DevExpress.XtraEditors.WindowsFormsSettings.TouchUIMode = TouchUIMode.Default; DevExpress.XtraEditors.WindowsFormsSettings.TouchScaleFactor = 1.0F; DevExpress.XtraEditors.WindowsFormsSettings.ScrollUIMode = ScrollUIMode.Default; DevExpress.XtraEditors.WindowsFormsSettings.ShowTouchScrollBarOnMouseMove = true; DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font(DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont.FontFamily, 9); }
                1. 기본 이벤트 정의 추가

                public KIOSKControl(IVIZZARDService conn) : this() { Connector = conn; // 프로그램 초기화 완료 이벤트 Connector.OnInitializedAppEvent += Connector_OnInitializedAppEvent; // 타일 클릭 이벤트 Connector.OnClickedTileEvent += Connector_OnClickedTileEvent; } private void Connector_OnInitializedAppEvent(object sender, EventArgs e) { // 컨테이너 반환 windowsTileContainer = (TileContainer)Connector.GetTileContainer(0); // 타이틀 변경 windowsTileContainer.Caption = "MyKIOSK Caption"; // UIView 반환 windowsUIView = (WindowsUIView)Connector.GetTileContainer(1); windowsUIView.ContentContainerActionCustomization += WindowsUIView_ContentContainerActionCustomization; // 종료 버튼 추가 AddExitTile(windowsUIView); } private void Connector_OnClickedTileEvent(object sender, ClickedTileEventArgs e) { // 현재 컨트롤 호출 여부 판단 if (e.KIOSK_CONTROL != this) return; // VIZCoreUserControl의 생성 여부 if (VIZCoreUserControl == null) { // VIZCoreUserControl 생성 VIZCoreUserControl = (VIZViewer)Connector.CreateVIZCoreControl(); VIZCoreUserControl.Dock = DockStyle.Fill; // 생성된 VIZCore UserControl을 Container에 추가 // 현재 화면에 Panel pcView 컨트롤이 있는 경우 pcView.Controls.Add(VIZCoreUserControl); // VIZCoreUserControl 개별 Event 초기화 InitVIZCoreUserControlEvent(); } } private void WindowsUIView_ContentContainerActionCustomization(object sender, ContentContainerActionCustomizationEventArgs e) { try { // Back 제어 var backItem = e.Actions.First((a) => a.Caption == "Back"); if (backItem != null) e.Remove(backItem); // Exit 제어 var exitItem = e.Actions.First((a) => a.Caption == "Exit"); if (exitItem != null) e.Remove(exitItem); } catch (Exception) { } } private void AddExitTile(WindowsUIView uiView) { try { uiView.BeginUpdate(); // 타일 엘리먼트 생성 DevExpress.XtraEditors.TileItemElement element = new DevExpress.XtraEditors.TileItemElement() { Text = "종료", Image = null, ImageAlignment = TileItemContentAlignment.MiddleCenter, ImageToTextAlignment = TileControlImageToTextAlignment.Bottom, TextAlignment = TileItemContentAlignment.MiddleCenter }; //Creating Documents DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document doc1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document(); doc1.Caption = "종료"; //Creating and Customizing Tiles DevExpress.XtraBars.Docking2010.Views.WindowsUI.Tile tile = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Tile(); tile.Group = "Group 1"; tile.Properties.ItemSize = DevExpress.XtraEditors.TileItemSize.Medium; tile.Document = doc1; tile.Elements.Add(element); windowsTileContainer.Items.AddRange(new DevExpress.XtraBars.Docking2010.Views.WindowsUI.BaseTile[] { tile }); tile.Click += Tile_Click; uiView.EndUpdate(); } catch (Exception) { } } private void Tile_Click(object sender, TileClickEventArgs e) { Connector.Exit(true); }
                1. KIOSK VIZCore Control 관련 함수 추가

                private void InitVIZCoreUserControlEvent() { // VIZCoreControl 초기화 완료 이벤트 VIZCoreUserControl.OnInitializedVIZCoreEvent += VIZCoreUserControl_OnInitializedVIZCoreEvent; // 모델 선택 이벤트 VIZCoreUserControl.OnObjectSelectedEvent += VIZCoreUserControl_OnObjectSelectedEvent; // 파일 열기 완료 이벤트 VIZCoreUserControl.OnOpenedDocumentEvent += VIZCoreUserControl_OnOpenedDocumentEvent; } private void VIZCoreUserControl_OnInitializedVIZCoreEvent(object sender, EventArgs e) { } private void VIZCoreUserControl_OnObjectSelectedEvent(object sender, ObjectSelectedEventArgs e) { } private void VIZCoreUserControl_OnOpenedDocumentEvent(object sender, OpenedDocumentEventArgs e) { } private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); string OpenFileFilter = "All Model Format (*.viz;*.vizxml;*.rvt;*.rev;*.rvm)"; OpenFileFilter += "|*.viz;*.vizxml;*.rvt;*.rev;*.rvm"; OpenFileFilter += "|VIZZARD (*.viz;*.vizxml)|*.viz;*.vizxml"; OpenFileFilter += "|Review Text (*.rvt;*.rev)|*.rvt;*.rev"; OpenFileFilter += "|Review Binary (*.rvm)|*.rvm"; if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; if (VIZCoreUserControl.IsOpenDocument()) { VIZCoreUserControl.CloseDocument(); VIZCoreUserControl.EnableRender(true); } bool bResult = VIZCoreUserControl.OpenDocument(dlg.FileName); bResult = VIZCoreUserControl.IsOpenDocument(); VIZCoreUserControl.SetRenderMode(RenderModes.SMOOTH_EDGE); }
                1. Plugin.xml 정의

                기본 코드 내용

                using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using SHConnector; namespace MyKIOSK { public partial class KIOSKControl : UserControl, IEntryConnector { // ======================================== // Property // ======================================== public IVIZZARDService Connector { get; set; } // ======================================== // Construction // ======================================== public KIOSKControl() { InitializeComponent(); } public KIOSKControl(IVIZZARDService conn) : this() { Connector = conn; } // ======================================== // Custom License // ======================================== public bool CheckLicense(int hostApp) { return true; } } }

                최종 코드 내용

                using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using SHConnector; using DevExpress.XtraBars.Docking2010.Views.WindowsUI; using DevExpress.XtraEditors; using DevExpress.LookAndFeel; namespace MyKIOSK { public partial class KIOSKControl : UserControl, IEntryConnector { // ======================================== // Property // ======================================== public IVIZZARDService Connector { get; set; } // VIZCore3D UserControl public VIZViewer VIZCoreUserControl { get; set; } // 타일 컨테이너 객체 private DevExpress.XtraBars.Docking2010.Views.WindowsUI.TileContainer windowsTileContainer; // UI View 객체 private DevExpress.XtraBars.Docking2010.Views.WindowsUI.WindowsUIView windowsUIView; // ======================================== // Construction // ======================================== public KIOSKControl() { InitializeComponent(); DevExpress.XtraEditors.WindowsFormsSettings.TouchUIMode = TouchUIMode.Default; DevExpress.XtraEditors.WindowsFormsSettings.TouchScaleFactor = 1.0F; DevExpress.XtraEditors.WindowsFormsSettings.ScrollUIMode = ScrollUIMode.Default; DevExpress.XtraEditors.WindowsFormsSettings.ShowTouchScrollBarOnMouseMove = true; DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font(DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont.FontFamily, 9); } public KIOSKControl(IVIZZARDService conn) : this() { Connector = conn; // 프로그램 초기화 완료 이벤트 Connector.OnInitializedAppEvent += Connector_OnInitializedAppEvent; // 타일 클릭 이벤트 Connector.OnClickedTileEvent += Connector_OnClickedTileEvent; } // ======================================== // Custom License // ======================================== public bool CheckLicense(int hostApp) { return true; } // ======================================== // Event // ======================================== private void Connector_OnInitializedAppEvent(object sender, EventArgs e) { // 컨테이너 반환 windowsTileContainer = (TileContainer)Connector.GetTileContainer(0); // 타이틀 변경 windowsTileContainer.Caption = "MyKIOSK Caption"; // UIView 반환 windowsUIView = (WindowsUIView)Connector.GetTileContainer(1); windowsUIView.ContentContainerActionCustomization += WindowsUIView_ContentContainerActionCustomization; // 종료 버튼 추가 AddExitTile(windowsUIView); } private void Connector_OnClickedTileEvent(object sender, ClickedTileEventArgs e) { // 현재 컨트롤 호출 여부 판단 if (e.KIOSK_CONTROL != this) return; // VIZCoreUserControl의 생성 여부 if (VIZCoreUserControl == null) { // VIZCoreUserControl 생성 VIZCoreUserControl = (VIZViewer)Connector.CreateVIZCoreControl(); VIZCoreUserControl.Dock = DockStyle.Fill; pcView.Controls.Add(VIZCoreUserControl); // VIZCoreUserControl 개별 Event 초기화 InitVIZCoreUserControlEvent(); } } private void WindowsUIView_ContentContainerActionCustomization(object sender, ContentContainerActionCustomizationEventArgs e) { try { // Back 제어 var backItem = e.Actions.First((a) => a.Caption == "Back"); if (backItem != null) e.Remove(backItem); // Exit 제어 var exitItem = e.Actions.First((a) => a.Caption == "Exit"); if (exitItem != null) e.Remove(exitItem); } catch (Exception) { } } private void AddExitTile(WindowsUIView uiView) { try { uiView.BeginUpdate(); // 타일 엘리먼트 생성 DevExpress.XtraEditors.TileItemElement element = new DevExpress.XtraEditors.TileItemElement() { Text = "종료", Image = null, ImageAlignment = TileItemContentAlignment.MiddleCenter, ImageToTextAlignment = TileControlImageToTextAlignment.Bottom, TextAlignment = TileItemContentAlignment.MiddleCenter }; //Creating Documents DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document doc1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document(); doc1.Caption = "종료"; //Creating and Customizing Tiles DevExpress.XtraBars.Docking2010.Views.WindowsUI.Tile tile = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Tile(); tile.Group = "Group 1"; tile.Properties.ItemSize = DevExpress.XtraEditors.TileItemSize.Medium; tile.Document = doc1; tile.Elements.Add(element); windowsTileContainer.Items.AddRange(new DevExpress.XtraBars.Docking2010.Views.WindowsUI.BaseTile[] { tile }); tile.Click += Tile_Click; uiView.EndUpdate(); } catch (Exception) { } } private void Tile_Click(object sender, TileClickEventArgs e) { Connector.Exit(true); } private void InitVIZCoreUserControlEvent() { // VIZCoreControl 초기화 완료 이벤트 VIZCoreUserControl.OnInitializedVIZCoreEvent += VIZCoreUserControl_OnInitializedVIZCoreEvent; // 모델 선택 이벤트 VIZCoreUserControl.OnObjectSelectedEvent += VIZCoreUserControl_OnObjectSelectedEvent; // 파일 열기 완료 이벤트 VIZCoreUserControl.OnOpenedDocumentEvent += VIZCoreUserControl_OnOpenedDocumentEvent; } private void VIZCoreUserControl_OnInitializedVIZCoreEvent(object sender, EventArgs e) { } private void VIZCoreUserControl_OnObjectSelectedEvent(object sender, ObjectSelectedEventArgs e) { } private void VIZCoreUserControl_OnOpenedDocumentEvent(object sender, OpenedDocumentEventArgs e) { } private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); string OpenFileFilter = "All Model Format (*.viz;*.vizxml;*.rvt;*.rev;*.rvm)"; OpenFileFilter += "|*.viz;*.vizxml;*.rvt;*.rev;*.rvm"; OpenFileFilter += "|VIZZARD (*.viz;*.vizxml)|*.viz;*.vizxml"; OpenFileFilter += "|Review Text (*.rvt;*.rev)|*.rvt;*.rev"; OpenFileFilter += "|Review Binary (*.rvm)|*.rvm"; if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; if (VIZCoreUserControl.IsOpenDocument()) { VIZCoreUserControl.CloseDocument(); VIZCoreUserControl.EnableRender(true); } bool bResult = VIZCoreUserControl.OpenDocument(dlg.FileName); bResult = VIZCoreUserControl.IsOpenDocument(); VIZCoreUserControl.SetRenderMode(RenderModes.SMOOTH_EDGE); } } }
                Last modified: 04 3월 2024