Ejemplo n.º 1
0
        protected override void AddStatus(string pageId, string value)
        {
            if (value == "-")
            {
                return;
            }
            int   pos = value.IndexOf(",", StringComparison.Ordinal);
            Color col;
            Color col2;

            if (pos == -1)
            {
                col  = ToolSet.ConvertFromHtmlColor(value);
                col2 = Color.clear;
            }
            else
            {
                col  = ToolSet.ConvertFromHtmlColor(value.Substring(0, pos));
                col2 = ToolSet.ConvertFromHtmlColor(value.Substring(pos + 1));
            }
            if (pageId == null)
            {
                this._default.color       = col;
                this._default.strokeColor = col2;
                return;
            }
            this._storage[pageId] = new GearColorValue(col, col2);
        }
        /// <summary>
        /// Initialize the component.
        /// </summary>
        public override void Start()
        {
            _calendar = new Calendar();

            _appointmentDate = Platform.Time;   // init to current time

            // define the structure of the appointments table
            _appointments = new Table <CalendarEvent>();
            _appointments.Columns.Add(new TableColumn <CalendarEvent, string>(SR.AppointmentTableDate,
                                                                              delegate(CalendarEvent e) { return(Format.Date(e.StartTime)); }));
            _appointments.Columns.Add(new TableColumn <CalendarEvent, string>(SR.AppointmentTableComment,
                                                                              delegate(CalendarEvent e) { return(e.Description); }));

            // create extension tools and action models
            _extensionTools = new ToolSet(new SchedulingToolExtensionPoint(), new SchedulingToolContext(this));
            _menuModel      = ActionModelRoot.CreateModel(this.GetType().FullName, "scheduling-appointments-contextmenu", _extensionTools.Actions);
            _toolbarModel   = ActionModelRoot.CreateModel(this.GetType().FullName, "scheduling-appointments-toolbar", _extensionTools.Actions);

            // initialize patient info from active workspace
            UpdatePatientInfo(this.Host.DesktopWindow.ActiveWorkspace);

            // subscribe to desktop window for changes in active workspace
            this.Host.DesktopWindow.Workspaces.ItemActivationChanged += Workspaces_ItemActivationChanged;


            base.Start();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="value"></param>
        public void ReplaceSelection(string value)
        {
            if (!editable)
            {
                throw new Exception("InputTextField is not editable.");
            }

            if (!_editing)
            {
                Stage.inst.focus = this;
            }

            textField.Rebuild();
            int t0, t1;

            if (_selectionStart != _caretPosition)
            {
                if (_selectionStart < _caretPosition)
                {
                    t0             = _selectionStart;
                    t1             = _caretPosition;
                    _caretPosition = _selectionStart;
                }
                else
                {
                    t0 = _caretPosition;
                    t1 = _selectionStart;
                    _selectionStart = _caretPosition;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }

                t0 = t1 = _caretPosition;
            }

            StringBuilder buffer = new StringBuilder();

            buffer.Append(_text, 0, t0);
            if (!string.IsNullOrEmpty(value))
            {
                value = ToolSet.FormatCRLF(value);
                value = ValidateInput(value);
                buffer.Append(value);

                _caretPosition += value.Length;
            }
            buffer.Append(_text, t1 + _composing, _text.Length - t1 - _composing);
            if (maxLength > 0 && buffer.Length > maxLength)
            {
                buffer.Length = maxLength;
            }

            this.text = buffer.ToString();
            onChanged.Call();
        }
        public override void Start()
        {
            // TODO prepare the component for its live phase
            base.Start();

            // initialize the list object that will display the shreds
            _shredCollection = new Table <Shred>();
            _shredCollection.Columns.Add(new TableColumn <Shred, string>("Shreds",
                                                                         delegate(Shred shred) { return(shred.Name); }
                                                                         ));
            _shredCollection.Columns.Add(new TableColumn <Shred, string>("Status",
                                                                         delegate(Shred shred) { return((shred.IsRunning) ? "Running" : "Stopped"); }
                                                                         ));

            // refresh the state of the Shred Host and shreds
            Refresh();

            _toolSet          = new ToolSet(new ShredHostClientToolExtensionPoint(), new ShredHostClientToolContext(this));
            _toolbarModel     = ActionModelRoot.CreateModel(this.GetType().FullName, "shredhostclient-toolbar", _toolSet.Actions);
            _contextMenuModel = ActionModelRoot.CreateModel(this.GetType().FullName, "shredhostclient-contextmenu", _toolSet.Actions);

            _refreshTask = new BackgroundTask(delegate(IBackgroundTaskContext context)
            {
                while (true)
                {
                    System.Threading.Thread.Sleep(2000);
                    Refresh();
                }
            }, true
                                              );

            _refreshTask.Run();
        }
Ejemplo n.º 5
0
 public void RegisterImageViewerTool(ToolSet set)
 {
     foreach (ITool tool in set.Tools)
     {
         _shortcutManager.RegisterImageViewerTool(tool);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Override of <see cref="ApplicationComponent.Start"/>
        /// </summary>
        /// <remarks>
        /// For internal Framework use only.
        /// </remarks>
        public override void Start()
        {
            base.Start();

            _uiThreadSynchronizationContext = SynchronizationContext.Current;

            _contextMenuFilter = _setupHelper.GetContextMenuFilter() ?? ViewerActionFilter.Null;
            _contextMenuFilter.SetImageViewer(this);

            _toolbarFilter = _setupHelper.GetToolbarFilter() ?? ViewerActionFilter.Null;
            _toolbarFilter.SetImageViewer(this);

            _toolSet = new ToolSet(CreateTools(), CreateToolContext());

            // since the keyboard action model is otherwise never used, we explicitly invoke it here to apply the persisted action model values to the actions
            ActionModelRoot.CreateModel(ActionsNamespace, KeyboardSite, _toolSet.Actions);

            foreach (ITool tool in _toolSet.Tools)
            {
                _shortcutManager.RegisterImageViewerTool(tool);
            }

            this.backgroundWorker = new BackgroundWorker();
            this.backgroundWorker.WorkerSupportsCancellation = true;
            this.backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker_DoWork);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 一键生成汇总表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            //得到报告筛选规则
            RuleConfigHelper ruleConfigHelper = new RuleConfigHelper();

            RuleConfigHelper.ReadConfig();

            //wordlist用于存储评估报告文档文件信息集合
            List <FileInfo> wordlist = new List <FileInfo>();
            //获取所有类型的文件
            List <FileInfo> fileNames = ToolSet.TogetFile(this.textBox1.Text, 2);

            this.textBox2.AppendText("目录包含以下Word评估报告:\r\n");
            foreach (FileInfo fileName in fileNames)
            {
                //过滤非评估报告类的文件
                if (fileName.Extension.Contains("doc") && (fileName.Name.ToUpper().Contains(RuleConfigHelper.FileName1) || fileName.Name.ToUpper().Contains(RuleConfigHelper.FileName2)))
                {
                    this.textBox2.AppendText(" -- " + fileName.Name + "\r\n");
                    wordlist.Add(fileName);
                }
            }
            this.textBox2.AppendText($"共计{wordlist.Count()}个\r\n");

            //调用汇总方法
            string workinfo = ToolSet.StartSummary(wordlist);

            this.textBox2.AppendText(workinfo);
            //this.textBox2.AppendText(ToolSet.information);
        }
Ejemplo n.º 8
0
        void DrawFrame()
        {
            _forceDraw = false;

            if (_currentFrame >= frames.Length)
            {
                graphics.ClearMesh();
            }
            else
            {
                Frame frame = frames[_currentFrame];

                if (frame.rect.width == 0)
                {
                    graphics.ClearMesh();
                }
                else
                {
                    Rect uvRect = frame.uvRect;
                    if (_flip != FlipType.None)
                    {
                        ToolSet.FlipRect(ref uvRect, _flip);
                    }

                    graphics.DrawRect(frame.rect, uvRect, _color);
                    if (frame.rotated)
                    {
                        NGraphics.RotateUV(graphics.uv, ref uvRect);
                    }
                    graphics.UpdateMesh();
                }
            }
        }
Ejemplo n.º 9
0
        //------------------------------
        private void PlayGrid()
        {
            GComponent obj   = _demoObjects["Grid"];
            GList      list1 = obj.GetChild("list1").asList;

            list1.RemoveChildrenToPool();
            string[] testNames = System.Enum.GetNames(typeof(System.IO.FileAttributes));
            Color[]  testColor = new Color[] { Color.Yellow, Color.Red, Color.White, Color.Cyan };
            int      cnt       = testNames.Length;

            for (int i = 0; i < cnt; i++)
            {
                GButton item = list1.AddItemFromPool().asButton;
                item.GetChild("t0").text = "" + (i + 1);
                item.GetChild("t1").text = testNames[i];
                item.GetChild("t2").asTextField.color  = testColor[ToolSet.Random(0, 4)];
                item.GetChild("star").asProgress.value = (int)((float)ToolSet.Random(1, 4) / 3f * 100);
            }

            GList list2 = obj.GetChild("list2").asList;

            list2.RemoveChildrenToPool();
            for (int i = 0; i < cnt; i++)
            {
                GButton item = list2.AddItemFromPool().asButton;
                item.GetChild("cb").asButton.selected = false;
                item.GetChild("t1").text = testNames[i];
                item.GetChild("mc").asMovieClip.playing = i % 2 == 0;
                item.GetChild("t3").text = "" + ToolSet.Random(0, 10000);
            }
        }
Ejemplo n.º 10
0
        override public void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("Label");

            if (xml == null)
            {
                this.title = string.Empty;
                this.icon  = null;
                return;
            }

            this.title = xml.GetAttribute("title");
            this.icon  = xml.GetAttribute("icon");
            string str = xml.GetAttribute("titleColor");

            if (str != null)
            {
                this.titleColor = ToolSet.ConvertFromHtmlColor(str);
            }

            if (_titleObject is GTextInput)
            {
                str = xml.GetAttribute("promptText");
                if (str != null)
                {
                    ((GTextInput)_titleObject).promptText = str;
                }
            }
        }
Ejemplo n.º 11
0
        override public void Setup_BeforeAdd(XML xml)
        {
            string str;
            string type = xml.GetAttribute("type");

            if (type != null && type != "empty")
            {
                _shape        = new Shape();
                _shape.gOwner = this;
                _shape.SetScale(GRoot.contentScaleFactor, GRoot.contentScaleFactor);
                displayObject = _shape;
            }

            base.Setup_BeforeAdd(xml);

            if (_shape != null)
            {
                int lineSize;
                str = xml.GetAttribute("lineSize");
                if (str != null)
                {
                    lineSize = int.Parse(str);
                }
                else
                {
                    lineSize = 1;
                }

                Color lineColor;
                str = xml.GetAttribute("lineColor");
                if (str != null)
                {
                    lineColor = ToolSet.ConvertFromHtmlColor(str);
                }
                else
                {
                    lineColor = Color.black;
                }

                Color fillColor;
                str = xml.GetAttribute("fillColor");
                if (str != null)
                {
                    fillColor = ToolSet.ConvertFromHtmlColor(str);
                }
                else
                {
                    fillColor = Color.white;
                }

                string corner;
                str = xml.GetAttribute("corner");
                if (str != null)
                {
                    corner = str;
                }

                DrawRect(this.width, this.height, lineSize, lineColor, fillColor);
            }
        }
Ejemplo n.º 12
0
        override public void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;

            str = xml.GetAttribute("color");
            if (str != null)
            {
                _content.color = ToolSet.ConvertFromHtmlColor(str);
            }

            str = xml.GetAttribute("flip");
            if (str != null)
            {
                _content.flip = FieldTypes.ParseFlipType(str);
            }

            str = xml.GetAttribute("fillMethod");
            if (str != null)
            {
                _content.fillMethod = FieldTypes.ParseFillMethod(str);
            }

            if (_content.fillMethod != FillMethod.None)
            {
                _content.fillOrigin    = xml.GetAttributeInt("fillOrigin");
                _content.fillClockwise = xml.GetAttributeBool("fillClockwise", true);
                _content.fillAmount    = (float)xml.GetAttributeInt("fillAmount", 100) / 100;
            }
        }
Ejemplo n.º 13
0
        override public void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;

            str = xml.GetAttribute("frame");
            if (str != null)
            {
                _content.currentFrame = int.Parse(str);
            }
            _content.playing = xml.GetAttributeBool("playing", true);

            str = xml.GetAttribute("color");
            if (str != null)
            {
                this.color = ToolSet.ConvertFromHtmlColor(str);
            }

            str = xml.GetAttribute("flip");
            if (str != null)
            {
                _content.flip = FieldTypes.ParseFlipType(str);
            }
        }
Ejemplo n.º 14
0
        void RenderListItem(int index, GObject obj)
        {
            GButton button = (GButton)obj;

            button.icon  = "i" + ToolSet.Random(0, 10);
            button.title = "" + ToolSet.Random(0, 100);
        }
Ejemplo n.º 15
0
        void ValidateMatrix(bool checkParent)
        {
            if (parent != null)
            {
                if (checkParent)
                {
                    parent.ValidateMatrix(checkParent);
                }
                if (_parentMatrixVersion != parent._matrixVersion)
                {
                    _outlineChanged      = true;
                    _parentMatrixVersion = parent._matrixVersion;
                }
            }

            if (_outlineChanged)
            {
                _outlineChanged = false;
                _matrixVersion++;

                Matrix mat = ToolSet.CreateMatrix(_position, _rotation, new Vector3(_scale.X, _scale.Y, 1), _skew);
                if (parent != null)
                {
                    _localToWorldMatrix = mat * parent._localToWorldMatrix;
                }
                else
                {
                    _localToWorldMatrix = mat;
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initializes the application. Override this method to perform custom initialization.
        /// </summary>
        /// <remarks>
        /// Initializes the application, including the session manager, application tools and root window.
        /// The GUI toolkit and application view have already been initialized prior to this method being
        /// called.
        /// </remarks>
        /// <param name="args">Arguments passed in from the command line.</param>
        /// <returns>True if initialization was successful, false if the application should terminate immediately.</returns>
        protected virtual bool Initialize(string[] args)
        {
            // initialize the application UI culture from local setting
            CurrentUICulture = InstalledLocales.Instance.Selected.GetCultureInfo();

            // initialize session
            if (!InitializeSessionManager())
            {
                return(false);
            }

            UserUpgradeProgressDialog.RunUpgradeAndShowProgress();

            // load tools
            _toolSet = new ToolSet(new ApplicationToolExtensionPoint(), new ApplicationToolContext(this));

            try
            {
                // create a root window
                _windows.AddNew("Root");
            }
            catch (Exception e)
            {
                ExceptionHandler.ReportUnhandled(e);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Called after the GUI toolkit message loop terminates, to clean up the application.  Override
        /// this method to perform custom clean-up.  Be sure to call the base class method.
        /// </summary>
        protected virtual void CleanUp()
        {
            _synchronizationContext = null;
            if (_view != null && _view is IDisposable)
            {
                (_view as IDisposable).Dispose();
                _view = null;
            }

            if (_toolSet != null)
            {
                _toolSet.Dispose();
                _toolSet = null;
            }

            if (_windows != null)
            {
                (_windows as IDisposable).Dispose();
            }

            if (_guiToolkit != null && _guiToolkit is IDisposable)
            {
                (_guiToolkit as IDisposable).Dispose();
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="targetSpace">null if to world space</param>
        /// <returns></returns>
        public Rect TransformRect(Rect rect, DisplayObject targetSpace)
        {
            if (targetSpace == null)
            {
                targetSpace = Stage.inst;
            }

            if (targetSpace == this)
            {
                return(rect);
            }

            if (targetSpace == parent && _rotation.z == 0)             // optimization
            {
                return(new Rect((this.x + rect.x) * _scale.x, (this.y + rect.y) * _scale.y,
                                rect.Width * _scale.x, rect.Height * _scale.y));
            }
            else
            {
                ValidateMatrix(true);

                Matrix4x4 mat = targetSpace.transformMatrix.GetInverted();
                ToolSet.TransformRect(ref rect, ref _localToWorldMatrix, ref mat);

                return(rect);
            }
        }
Ejemplo n.º 19
0
        private bool AddConeModelsFilesToArchive(ToolSet toolSet, ZipArchive archive)
        {
            bool result = true;

            foreach (var item in toolSet.Tools)
            {
                if (!string.IsNullOrEmpty(item.ConeModelFile))
                {
                    FileInfo info = new FileInfo(item.ConeModelFile);

                    if (info.Exists)
                    {
                        var name = info.Name;

                        if (!_entrieeNames.Contains(name))
                        {
                            var entry = archive.CreateEntryFromFile(item.ConeModelFile, name);
                            _entrieeNames.Add(name);
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 20
0
        void DrawFrame()
        {
            _displayFrame = _frame;
            graphics.Clear();

            if (_frame < frames.Length)
            {
                Frame frame = frames[_frame];

                if (frame.rect.Width != 0)
                {
                    Rect uvRect = frame.uvRect;
                    if (_flip != FlipType.None)
                    {
                        ToolSet.FlipRect(ref uvRect, _flip);
                    }

                    graphics.AddQuad(frame.rect, uvRect, _color);
                    if (frame.rotated)
                    {
                        graphics.RotateUV(ref uvRect);
                    }
                }
            }
        }
        public override void Start()
        {
            _profileTable = new PatientProfileTable();
            _toolSet      = new ToolSet(new PatientSearchToolExtensionPoint(), new PatientSearchToolContext(this));

            base.Start();
        }
Ejemplo n.º 22
0
    protected void OnToolbarArea(Event guiEvent, Rect guiRect)
    {
        int activeButton = (int)activeTool;

        if ((activeTool != ToolSet.View) && (activeViewTool != ViewTool.None))
        {
            activeButton = ToolView;
        }

        int newButton = GUI.Toolbar(guiRect, activeButton, toolIcons);

        if (newButton != activeButton)
        {
            switch (newButton)
            {
            case ToolView:
                activeTool = ToolSet.View;
                break;

            case ToolSelect:
                activeTool = ToolSet.Select;
                break;

            case ToolBrush:
                SetFocusedShape(null);
                activeTool = ToolSet.Brush;
                break;

            case ToolShape:
                SetFocusedShape(null);
                activeTool = ToolSet.Shape;
                break;
            }
        }
    }
Ejemplo n.º 23
0
        override protected void AddStatus(string pageId, string value)
        {
            if (value == "-" || value.Length == 0)
            {
                return;
            }

            Color col1;
            Color col2;
            int   pos = value.IndexOf(",");

            if (pos == -1)
            {
                col1 = ToolSet.ConvertFromHtmlColor(value);
                col2 = Color.clear;
            }
            else
            {
                col1 = ToolSet.ConvertFromHtmlColor(value.Substring(0, pos));
                col2 = ToolSet.ConvertFromHtmlColor(value.Substring(pos + 1));
            }

            if (pageId == null)
            {
                _default.color       = col1;
                _default.strokeColor = col2;
            }
            else
            {
                _storage[pageId] = new GearColorValue(col1, col2);
            }
        }
Ejemplo n.º 24
0
        void DrawFrame()
        {
            _forceDraw = false;

            if (_currentFrame >= frames.Length)
            {
                graphics.ClearMesh();
            }
            else
            {
                Frame frame = frames[_currentFrame];

                if (frame.rect.width == 0)
                {
                    graphics.ClearMesh();
                }
                else
                {
                    Rect uvRect = frame.uvRect;
                    if (_flip != FlipType.None)
                    {
                        ToolSet.FlipRect(ref uvRect, _flip);
                    }

                    graphics.SetOneQuadMesh(frame.rect, uvRect, _color, null, frame.rotated);
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="targetSpace">null if to world space</param>
        /// <returns></returns>
        public Rectangle TransformRect(Rectangle rect, DisplayObject targetSpace)
        {
            if (targetSpace == null)
            {
                targetSpace = Stage.inst;
            }

            if (targetSpace == this)
            {
                return(rect);
            }

            if (targetSpace == parent && _rotation.Z == 0)             // optimization
            {
                return(new Rectangle((this.x + rect.X) * _scale.X, (this.y + rect.Y) * _scale.Y,
                                     rect.Width * _scale.X, rect.Height * _scale.Y));
            }
            else
            {
                ValidateMatrix(true);

                Matrix mat = Matrix.Invert(targetSpace.transformMatrix);
                ToolSet.TransformRect(ref rect, ref _localToWorldMatrix, ref mat);

                return(rect);
            }
        }
Ejemplo n.º 26
0
        private void NewToolSet()
        {
            _viewer  = new ImageViewerComponent();
            _context = new TestToolContext(_viewer);
            _toolSet = new ToolSet(CreateTools(), _context);

            MouseToolSettingsProfile.Reset();
        }
 /// <summary>
 /// Called by the host to initialize the application component.
 /// </summary>
 public override void Start()
 {
     // TODO prepare the component for its live phase
     base.Start();
     _toolSet          = new ToolSet(new ImageBrowserToolExtensionPoint(), new ImageBrowserToolContext(this));
     _toolbarModel     = ActionModelRoot.CreateModel(this.GetType().FullName, "dicomImageBrowser-toolbar", _toolSet.Actions);
     _contextMenuModel = ActionModelRoot.CreateModel(this.GetType().FullName, "dicomImageBrowser-contextmenu", _toolSet.Actions);
 }
        public override void Start()
        {
            base.Start();

            _toolSet          = new ToolSet(new ServerTreeToolExtensionPoint(), new ServerTreeToolContext(this));
            _toolbarModel     = ActionModelRoot.CreateModel(this.GetType().FullName, "servertree-toolbar", _toolSet.Actions);
            _contextMenuModel = ActionModelRoot.CreateModel(this.GetType().FullName, "servertree-contextmenu", _toolSet.Actions);
        }
Ejemplo n.º 29
0
 public GoWrapper(GameObject go)
 {
     _owner = go;
     this._skipInFairyBatching = true;
     CreateGameObject("GoWrapper");
     ToolSet.SetParent(_owner.transform, this.cachedTransform);
     CacheRenderers();
 }
        public override void Start()
        {
            _toolSet      = new ToolSet(_toolExtensionPoint, new ToolContext(this));
            _toolbarModel = ActionModelRoot.CreateModel(_toolsNamespace, _toolbarSite, _toolSet.Actions);
            _menuModel    = ActionModelRoot.CreateModel(_toolsNamespace, _menuSite, _toolSet.Actions);

            base.Start();
        }
Ejemplo n.º 31
0
		//public ToolViewManager(ToolManager toolManager, Window parentWindow)
		public ToolViewManager(ToolSet toolManager, Window parentWindow)
		{
			_toolManager = toolManager;
			_active = false;
			_viewHosts = new Dictionary<ToolViewProxy, ToolViewHostDialog>();
			_parentWindow = parentWindow;
			
			foreach(ToolViewProxy view in _toolManager.ToolViews)
			{
				view.ActivationChanged += OnToolViewActivationChanged;
			}
			
		}
        private void NewToolSet()
        {
            _viewer = new ImageViewerComponent();
            _context = new TestToolContext(_viewer);
            _toolSet = new ToolSet(CreateTools(), _context);

            MouseToolSettingsProfile.Reset();
        }