Exemplo n.º 1
0
        private void button_unionCatalog_findDp2Server_Click(object sender, EventArgs e)
        {
            dp2SearchForm dp2_searchform = this.MainForm.GetDp2SearchForm();

            GetDp2ResDlg dlg = new GetDp2ResDlg();

            GuiUtil.SetControlFont(dlg, this.Font);

            dlg.Text = "请指定要绑定的 dp2library 服务器名";
#if OLD_CHANNEL
            dlg.dp2Channels = dp2_searchform.Channels;
#endif
            dlg.ChannelManager = this.MainForm;
            dlg.Servers        = this.MainForm.Servers;
            dlg.EnabledIndices = new int[] { dp2ResTree.RESTYPE_SERVER };
            dlg.Path           = this.textBox_unionCatalog_bindingDp2ServerName.Text;

            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            this.textBox_unionCatalog_bindingDp2ServerName.Text = dlg.Path;
        }
Exemplo n.º 2
0
        private void OnClick(object sender, EventArgs e)
        {
            if (sender == _uiAddTarget)
            {
                Xml.Settings.General.NuGet.Target target = new Xml.Settings.General.NuGet.Target()
                {
                    Name = "Name", Moniker = string.Format("Moniker {0}", Definitions.Constants.Random.Next(100))
                };

                GuiUtil.AddItem(target, _options.NuGetOptions.Targets, _uiTargets);
            }
            else if (sender == _uiRemoveTarget && _selectedTarget != null)
            {
                GuiUtil.RemoveItem(_selectedTarget, _options.NuGetOptions.Targets, _uiTargets);
            }
            else if (sender == _uiApplyChanges && _selectedTarget != null)
            {
                foreach (Xml.Settings.General.NuGet.Target t in _options.NuGetOptions.Targets)
                {
                    if (t.Moniker == _uiCurrentTargetMoniker.Text && t != _selectedTarget)
                    {
                        MessageBox.Show("A target with the same moniker exists already, please change the moniker");
                        return;
                    }
                }

                _selectedTarget.Name    = _uiCurrentTargetName.Text;
                _selectedTarget.Moniker = _uiCurrentTargetMoniker.Text;

                _uiApplyChanges.Enabled = false;

                GuiUtil.RefreshItems(_uiTargets);
            }
        }
Exemplo n.º 3
0
    //--------------------------------------------------------------------------------------
    // Methods:
    //--------------------------------------------------------------------------------------

    /// <summary>
    /// Initializes the state.
    /// </summary>
    public override void Initialize()
    {
        core.LoadMenuScene();

        buttonNormal = core.LoadMenuTexture("Button1");
        buttonHover  = core.LoadMenuTexture("Button2");
        buttonActive = core.LoadMenuTexture("Button3");

        const int Y0 = 170, Y1 = 320, Y2 = 380;

        titleLblPos = getScaledValue(new Rect(INNER_BOX_X, 50, INNER_BOX_W, 80));
        msgLblPos   = getScaledValue(new Rect(INNER_BOX_X, Y0, INNER_BOX_W, 100));
        stepsLblPos = getScaledValue(new Rect(INNER_BOX_X, Y1, INNER_BOX_W, 50));
        timeLblPos  = getScaledValue(new Rect(INNER_BOX_X, Y2, INNER_BOX_W, 50));

        int w = buttonNormal.width, h = buttonNormal.height;

        continueBtnPos = getScaledValue(new Rect(460, 555, w, h));

        titleStyle = GuiUtil.MakeLabelStyle(FONT_SIZE_X4, AtariPalette.Hue00Lum00,
                                            TextAnchor.UpperCenter);
        textStyle = GuiUtil.MakeLabelStyle(FONT_SIZE_X2, AtariPalette.Hue00Lum00,
                                           TextAnchor.UpperCenter);
        buttonStyle = GuiUtil.MakeButtonStyle(FONT_SIZE_X1, AtariPalette.Hue00Lum00,
                                              buttonNormal, buttonHover, buttonActive);
    }
Exemplo n.º 4
0
        private void button_modifyBindingItem_Click(object sender, EventArgs e)
        {
            if (this.listView_recordSyntaxAndEncodingBinding.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选定要修改的事项");
                return;
            }

            ListViewItem item = this.listView_recordSyntaxAndEncodingBinding.SelectedItems[0];

            RecordSyntaxAndEncodingBindingItemDlg dlg = new RecordSyntaxAndEncodingBindingItemDlg();

            GuiUtil.SetControlFont(dlg, this.Font);

            dlg.RecordSyntax = item.Text;
            dlg.Encoding     = item.SubItems[1].Text;

            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            item.Text             = dlg.RecordSyntax;
            item.SubItems[1].Text = dlg.Encoding;
        }
Exemplo n.º 5
0
        private void button_findOverwriteDbName_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg  = new OpenResDlg();
            Font       font = GuiUtil.GetDefaultFont();

            if (font != null)
            {
                dlg.Font = font;
            }

            dlg.Text           = "请选择要覆盖的目标数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            //dlg.ap = this.applicationInfo;
            //dlg.ApCfgTitle = "pageimport_openresdlg";
            dlg.MultiSelect = false;
            dlg.Path        = textBox_overwriteDbName.Text;
            dlg.Initial(this.Servers,
                        this.Channels);
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            textBox_overwriteDbName.Text = dlg.Path;
        }
Exemplo n.º 6
0
    //--------------------------------------------------------------------------------------
    // Methods:
    //--------------------------------------------------------------------------------------

    /// <summary>
    /// Initializes the state.
    /// </summary>
    public override void Initialize()
    {
        buttonNormal = core.LoadMenuTexture("Button1");
        buttonHover  = core.LoadMenuTexture("Button2");
        buttonActive = core.LoadMenuTexture("Button3");

        leftButtonNormal = core.LoadMenuTexture("LeftButton1");
        leftButtonHover  = core.LoadMenuTexture("LeftButton2");
        leftButtonActive = core.LoadMenuTexture("LeftButton3");

        rightButtonNormal = core.LoadMenuTexture("RightButton1");
        rightButtonHover  = core.LoadMenuTexture("RightButton2");
        rightButtonActive = core.LoadMenuTexture("RightButton3");

        portraitFrame = core.LoadMenuTexture("PortaitFrame");
        portraits     = new Texture2D[ProfileData.MAX_AVATARS];
        for (int i = 0; i < ProfileData.MAX_AVATARS; i++)
        {
            portraits[i] = core.LoadMenuTexture("Portrait" + (i + 1));
        }
        textField = core.LoadMenuTexture("TextField");

        titleLblPos = getScaledValue(new Rect(INNER_BOX_X, 50, INNER_BOX_W, 50));

        int       pfw = portraitFrame.width, pfh = portraitFrame.height;
        int       pw = portraits[0].width, ph = portraits[0].height;
        const int PFX = 534, PFY = 200, POF = 24;

        portraitFramePos = getScaledValue(new Rect(PFX, PFY, pfw, pfh));
        portraitPos      = getScaledValue(new Rect(PFX + POF, PFY + POF, pw, ph));

        const int LX = 418, RX = 766, LRY = PFY + 58;
        int       lbw = leftButtonNormal.width, lbh = leftButtonNormal.height;
        int       rbw = rightButtonNormal.width, rbh = rightButtonNormal.height;

        leftBtnPos  = getScaledValue(new Rect(LX, LRY, lbw, lbh));
        rightBtnPos = getScaledValue(new Rect(RX, LRY, rbw, rbh));

        nameTxtPos = getScaledValue(new Rect(240, 430, textField.width, textField.height));

        const int X1 = 256, X2 = 664, Y2 = 555;
        int       w = buttonNormal.width, h = buttonNormal.height;

        createBtnPos = getScaledValue(new Rect(X1, Y2, w, h));
        cancelBtnPos = getScaledValue(new Rect(X2, Y2, w, h));

        victim       = new ProfileData();
        victim.Empty = false;

        titleStyle = GuiUtil.MakeLabelStyle(FONT_SIZE_X2, AtariPalette.Hue00Lum00,
                                            TextAnchor.MiddleCenter);
        leftButtonStyle = GuiUtil.MakeButtonStyle(leftButtonNormal, leftButtonHover,
                                                  leftButtonActive);
        rightButtonStyle = GuiUtil.MakeButtonStyle(rightButtonNormal, rightButtonHover,
                                                   rightButtonActive);
        textFieldStyle = GuiUtil.MakeTextFieldStyle(FONT_SIZE_X1, AtariPalette.Hue00Lum00,
                                                    textField);
        buttonStyle = GuiUtil.MakeButtonStyle(FONT_SIZE_X1, AtariPalette.Hue00Lum00,
                                              buttonNormal, buttonHover, buttonActive);
    }
Exemplo n.º 7
0
    protected virtual void OnGUI()
    {
        scroll  = EditorGUILayout.BeginScrollView(scroll);
        mNewMod = (E)EditorGUILayout.EnumPopup("模式", mNewMod);
        B ins = GetTexUtil(mNewMod);

        if (ins == null)
        {
            Debug.LogFormat("Error: 为获取到实例");
            return;
        }

        if (!mNewMod.Equals(mOldMod))
        {
            mOldMod = mNewMod;
            if (currIns != null)
            {
                currIns.OnExit();
            }
            ins.OnEnter();
            currIns = ins;
        }

        EditorGUILayout.LabelField(ins.mDescr);
        GuiUtil.NewLine();
        ins.Draw();
        EditorGUILayout.EndScrollView();
    }
Exemplo n.º 8
0
        void Browse_Click(object sender, EventArgs e)
        {
            var orig = CalFile.Control.Text;
            var user = GuiUtil.SimpleFileNameDialog("CAL Files|*.cal");

            CalFile.Control.Text = user != "" ? user : orig;
        }
Exemplo n.º 9
0
    public static GUIStyle GetSectionStyle()
    {
        if (_sectionStyle == null)
        {
            _sectionStyle      = new GUIStyle();
            _sectionStyle.name = "heu_ui_section";

            GUIStyleState styleState = new GUIStyleState();
            styleState.textColor = new Color(0.705f, 0.705f, 0.705f, 1.0f);
            _sectionStyle.active = styleState;

            _sectionStyle.alignment     = TextAnchor.UpperCenter;
            _sectionStyle.border        = new RectOffset(9, 9, 4, 14);
            _sectionStyle.clipping      = TextClipping.Clip;
            _sectionStyle.contentOffset = new Vector2(0f, 3f);
            _sectionStyle.imagePosition = ImagePosition.ImageLeft;

            string    textureName   = string.Format("heu_ui_section_box{0}", GuiUtil.IsEditorDarkSkin() ? "_d" : "");
            Texture2D normalTexture = Resources.Load <Texture2D>(textureName);

            GUIStyleState normalState = new GUIStyleState();
            normalState.background = normalTexture;
            _sectionStyle.normal   = normalState;

            _sectionStyle.overflow = new RectOffset(4, 4, 0, 9);
            _sectionStyle.padding  = new RectOffset(4, 4, 4, 4);

            _sectionStyle.richText     = false;
            _sectionStyle.stretchWidth = false;
        }
        return(_sectionStyle);
    }
Exemplo n.º 10
0
    //--------------------------------------------------------------------------------------
    // Methods:
    //--------------------------------------------------------------------------------------

    /// <summary>
    /// Initializes the state.
    /// </summary>
    public override void Initialize()
    {
        buttonNormal = core.LoadMenuTexture("Button1");
        buttonHover  = core.LoadMenuTexture("Button2");
        buttonActive = core.LoadMenuTexture("Button3");

        portraitFrame = core.LoadMenuTexture("PortaitFrame");
        portraits     = new Texture2D[ProfileData.MAX_AVATARS];
        for (int i = 0; i < ProfileData.MAX_AVATARS; i++)
        {
            portraits[i] = core.LoadMenuTexture("SadPortrait" + (i + 1));
        }

        int       pfw = portraitFrame.width, pfh = portraitFrame.height;
        int       pw = portraits[0].width, ph = portraits[0].height;
        const int PFX = 534, PFY = 200, POF = 24;

        msgLblPos        = getScaledValue(new Rect(INNER_BOX_X, 50, INNER_BOX_W, 100));
        portraitFramePos = getScaledValue(new Rect(PFX, PFY, pfw, pfh));
        portraitPos      = getScaledValue(new Rect(PFX + POF, PFY + POF, pw, ph));
        nameLblPos       = getScaledValue(new Rect(INNER_BOX_X, 430, INNER_BOX_W, 100));

        const int X1 = 256, X2 = 664, Y2 = 555;
        int       w = buttonNormal.width, h = buttonNormal.height;

        yesBtnPos = getScaledValue(new Rect(X1, Y2, w, h));
        noBtnPos  = getScaledValue(new Rect(X2, Y2, w, h));

        textStyle = GuiUtil.MakeLabelStyle(FONT_SIZE_X2, AtariPalette.Hue00Lum00,
                                           TextAnchor.MiddleCenter);
        nameStyle = GuiUtil.MakeLabelStyle(FONT_SIZE_X2, AtariPalette.Hue00Lum00,
                                           TextAnchor.UpperCenter);
        buttonStyle = GuiUtil.MakeButtonStyle(FONT_SIZE_X1, AtariPalette.Hue00Lum00,
                                              buttonNormal, buttonHover, buttonActive);
    }
Exemplo n.º 11
0
        // parameters:
        //      nTimeout    超时时间。毫秒数。-1 表示永不超时
        // return:
        //      DialogResult.Retry 表示超时了
        //      DialogResult.OK 表示点了 OK 按钮
        //      DialogResult.Cancel 表示点了右上角的 Close 按钮
        public static DialogResult Show(IWin32Window owner,
                                        string strText,
                                        int nTimeout    = -1,
                                        string strTitle = null)
        {
            AutoCloseMessageBox dlg = new AutoCloseMessageBox();
            Font font = GuiUtil.GetDefaultFont();

            if (font != null)
            {
                dlg.Font = font;
            }

            if (nTimeout != -1)
            {
                dlg.m_nTimeOut = nTimeout;
            }

            if (strTitle != null)
            {
                dlg.Text = strTitle;
            }
            dlg.label_message.Text = strText;
            dlg.StartPosition      = FormStartPosition.CenterScreen;
            return(dlg.ShowDialog(owner));
        }
Exemplo n.º 12
0
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);

            string strParameter = this.Context.Parameters["rootdir"];

            if (string.IsNullOrEmpty(strParameter) == true)
            {
                return;
            }

#if NO
            string strRootDir = UnQuote(this.Context.Parameters["rootdir"]);

            InstanceDialog dlg = new InstanceDialog();
            GuiUtil.AutoSetDefaultFont(dlg);

            dlg.SourceDir     = strRootDir;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(ForegroundWindow.Instance);

            if (dlg.DialogResult == DialogResult.Cancel)
            {
                throw new InstallException("用户取消安装。");
            }

            if (dlg.Changed == true)
            {
                // 兑现修改
            }
#endif
        }
Exemplo n.º 13
0
        void channel_BeforeLogin(object sender, BeforeLoginEventArgs e)
        {
            if (e.FirstTry == true)
            {
                e.UserName = this.SupervisorUserName;
                e.Password = this.SupervisorPassword;

                e.Parameters = "location=#setup,type=worker,client=dp2OPAC|0.01";   // 2016/5/6 加上 0.01 部分

                if (String.IsNullOrEmpty(e.UserName) == false)
                {
                    return; // 立即返回, 以便作第一次 不出现 对话框的自动登录
                }
            }

            //
            IWin32Window owner = null;

            if (sender is IWin32Window)
            {
                owner = (IWin32Window)sender;
            }
            else
            {
                owner = this;
            }

            CirculationLoginDlg dlg = new CirculationLoginDlg();

            GuiUtil.AutoSetDefaultFont(dlg);
            // dlg.Text = "";
            dlg.ServerUrl         = this.textBox_dp2LibraryUrl.Text;
            dlg.Comment           = e.ErrorInfo;
            dlg.UserName          = e.UserName;
            dlg.SavePasswordShort = false;
            dlg.SavePasswordLong  = false;
            dlg.Password          = e.Password;
            dlg.IsReader          = false;
            dlg.OperLocation      = "#setup";
            dlg.StartPosition     = FormStartPosition.CenterScreen;

            dlg.ShowDialog(owner);

            if (dlg.DialogResult == DialogResult.Cancel)
            {
                e.Cancel = true;
                return;
            }

            e.UserName          = dlg.UserName;
            e.Password          = dlg.Password;
            e.SavePasswordShort = dlg.SavePasswordShort;
            e.Parameters        = "location=#setup,type=worker,client=dp2OPAC|0.01"; // 2016/5/6 加上 0.01 部分

            e.SavePasswordLong = dlg.SavePasswordLong;
            e.LibraryServerUrl = dlg.ServerUrl;

            this.SupervisorUserName = e.UserName;
            this.SupervisorPassword = e.Password;
        }
Exemplo n.º 14
0
    //--------------------------------------------------------------------------------------
    // Methods:
    //--------------------------------------------------------------------------------------

    /// <summary>
    /// Initializes the state.
    /// </summary>
    public override void Initialize()
    {
        menuBarLeft   = core.LoadMenuTexture("MenuBar1");
        menuBarMiddle = core.LoadMenuTexture("MenuBar2");
        menuBarRight  = core.LoadMenuTexture("MenuBar3");

        buttonNormal = core.LoadMenuTexture("PauseButton1");
        buttonHover  = core.LoadMenuTexture("PauseButton2");
        buttonActive = core.LoadMenuTexture("PauseButton3");

        menuBarLeftPos   = getScaledValue(new Rect(0, 0, menuBarLeft.width, menuBarLeft.height));
        menuBarMiddlePos = getScaledValue(new Rect(0, 0, menuBarMiddle.width, menuBarMiddle.height));
        menuBarRightPos  = getScaledValue(new Rect(0, 0, menuBarRight.width, menuBarRight.height));

        menuBarMiddlePos.x     = menuBarLeftPos.x + menuBarLeftPos.width;
        menuBarRightPos.x      = Screen.width - menuBarRightPos.width;
        menuBarMiddlePos.width = menuBarRightPos.x - menuBarMiddlePos.x;

        int w = buttonNormal.width, h = buttonNormal.height;

        pauseBtnPos = getScaledValue(new Rect(16, 16, w, h));

        msgLblPos        = new Rect();
        msgLblPos.x      = menuBarMiddlePos.x;
        msgLblPos.width  = Screen.width - msgLblPos.x;
        msgLblPos.height = menuBarMiddlePos.height;

        buttonStyle = GuiUtil.MakeButtonStyle(FONT_SIZE_X1, AtariPalette.Hue00Lum00,
                                              buttonNormal, buttonHover, buttonActive);
        msgStyle = GuiUtil.MakeLabelStyle(FONT_SIZE_X1, AtariPalette.Hue00Lum00,
                                          TextAnchor.MiddleCenter);
    }
Exemplo n.º 15
0
        private void button_findServerName_Click(object sender, EventArgs e)
        {
            GetDp2ResDlg dlg = new GetDp2ResDlg();

            GuiUtil.SetControlFont(dlg, this.Font);

            dlg.Text = "请指定一个作为查重目标的 dp2library 服务器";
#if OLD_CHANNEL
            dlg.dp2Channels = this.Channels;
#endif
            dlg.ChannelManager = Program.MainForm;

            dlg.Servers        = this.MainForm.Servers;
            dlg.EnabledIndices = new int[] { dp2ResTree.RESTYPE_SERVER };
            dlg.Path           = this.textBox_serverName.Text;

            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            this.textBox_serverName.Text = dlg.Path;
        }
Exemplo n.º 16
0
        public static DialogResult Show(IWin32Window owner,
                                        string strText,
                                        string strCaption,
                                        MessageBoxButtons buttons,
                                        MessageBoxDefaultButton defaultButton,
                                        ref bool bChecked,
                                        string [] button_texts = null,
                                        string strCheckBoxText = "")
        {
            MessageDlg dlg  = new MessageDlg();
            Font       font = GuiUtil.GetDefaultFont();

            if (font != null)
            {
                dlg.Font = font;
            }
            if (string.IsNullOrEmpty(strCheckBoxText) == false)
            {
                dlg.checkBox_noAsk.Text = strCheckBoxText;
            }
            dlg.checkBox_noAsk.Checked = bChecked;
            dlg.buttons       = buttons;
            dlg.defaultButton = defaultButton;
            dlg.Message       = strText;
            dlg.Text          = strCaption;
            dlg.ButtonTexts   = button_texts;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(owner);

            bChecked = dlg.checkBox_noAsk.Checked;

            return(dlg.DialogResult);
        }
Exemplo n.º 17
0
        void menu_newServer(object sender, System.EventArgs e)
        {
            int nActiveLine = -1;

            if (ListView.SelectedIndices.Count != 0)
            {
                nActiveLine = ListView.SelectedIndices[0];
            }


            // ListViewItem item = listView1.Items[nActiveLine];

            LoginDlg dlg = new LoginDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text = "新增服务器地址和缺省帐户";

            if (nActiveLine == -1)
            {
                // 无参考事项情形的新增
                dlg.textBox_serverAddr.Text = "http://dp2003.com/dp2kernel";
                dlg.textBox_userName.Text   = "public";
            }
            else
            {
                dlg.textBox_password.Text         = ((Server)Servers[nActiveLine]).DefaultPassword;
                dlg.textBox_serverAddr.Text       = ((Server)Servers[nActiveLine]).Url;
                dlg.textBox_userName.Text         = ((Server)Servers[nActiveLine]).DefaultUserName;
                dlg.checkBox_savePassword.Checked = ((Server)Servers[nActiveLine]).SavePassword;
            }

            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            Server server = Servers.NewServer(nActiveLine);

            server.DefaultPassword = dlg.textBox_password.Text;
            server.Url             = dlg.textBox_serverAddr.Text;
            server.DefaultUserName = dlg.textBox_userName.Text;
            server.SavePassword    = dlg.checkBox_savePassword.Checked;

            Servers.Changed = true;

            FillList();

            // 选择一行
            // parameters:
            //		nIndex	要设置选择标记的行。如果==-1,表示清除全部选择标记但不选择。
            //		bMoveFocus	是否同时移动focus标志到所选择行
            ListViewUtil.SelectLine(ListView,
                                    Servers.Count - 1,
                                    true);

            m_bChanged = true;
        }
 private void DrawLine(Rect rect,
                       float thickness)
 {
     rect.y     += (rect.height - thickness) / 2;
     rect.height = thickness;
     GuiUtil.DrawRect(rect, TheAttribute.Color.GetColor());
 }
Exemplo n.º 19
0
        // parameters:
        //      x   内部坐标
        HitTestResult HitTest(float x, float y)
        {
            HitTestResult result = new HitTestResult();

            result.X          = x;
            result.Y          = y;
            result.CornerType = CornerType.None;

            if (this.Image == null)
            {
                return(result);
            }

            Rectangle display_rect = GetPictureBoxZoomSize();
            float     x_ratio      = (float)display_rect.Width / (float)this.Image.Width;
            float     scale_ratio  = (float)1 / x_ratio;

            // 左上
            RectangleF rect = GetBoxRect(_points[0], scale_ratio);

            if (GuiUtil.PtInRect(x,
                                 y,
                                 rect) == true)
            {
                result.CornerType = CornerType.LeftTop;
                return(result);
            }

            // 右上
            rect = GetBoxRect(_points[1], scale_ratio);
            if (GuiUtil.PtInRect(x,
                                 y,
                                 rect) == true)
            {
                result.CornerType = CornerType.RightTop;
                return(result);
            }

            // 右下
            rect = GetBoxRect(_points[2], scale_ratio);
            if (GuiUtil.PtInRect(x,
                                 y,
                                 rect) == true)
            {
                result.CornerType = CornerType.RightBottom;
                return(result);
            }

            // 左下
            rect = GetBoxRect(_points[3], scale_ratio);
            if (GuiUtil.PtInRect(x,
                                 y,
                                 rect) == true)
            {
                result.CornerType = CornerType.LeftBottom;
                return(result);
            }

            return(result);
        }
Exemplo n.º 20
0
        void BrowseDir_Click(object sender, EventArgs e)
        {
            var orig = Dir.Control.Text;
            var user = GuiUtil.SimpleFolderNameDialog();

            Dir.Control.Text = user != "" ? user : orig;
        }
Exemplo n.º 21
0
        public static DialogResult Show(IWin32Window owner,
                                        string strTitle,
                                        string strText,
                                        string strCheckBoxText,
                                        ref bool bCheckBox)
        {
            MessageDialog dlg = new MessageDialog();

            GuiUtil.AutoSetDefaultFont(dlg);
            dlg.Text = strTitle;
            if (strCheckBoxText == null)
            {
                dlg.CheckBoxVisible = false;
            }
            else
            {
                dlg.CheckBoxText = strCheckBoxText;
            }
            dlg.MessageText   = strText;
            dlg.CheckBoxValue = bCheckBox;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(owner);

            bCheckBox = dlg.CheckBoxValue;
            return(dlg.DialogResult);
        }
Exemplo n.º 22
0
        public static DialogResult Show(IWin32Window owner,
                                        string strText,
                                        MessageBoxButtons buttons,
                                        MessageBoxDefaultButton defaultbutton,
                                        string strCheckBoxText,
                                        ref bool bCheckBox,
                                        string[] button_texts = null)
        {
            MessageDialog dlg = new MessageDialog();

            GuiUtil.AutoSetDefaultFont(dlg);
            dlg.Text = "";
            if (strCheckBoxText == null)
            {
                dlg.CheckBoxVisible = false;
            }
            else
            {
                dlg.CheckBoxText = strCheckBoxText;
            }
            dlg.MessageText   = strText;
            dlg.CheckBoxValue = bCheckBox;
            dlg.StartPosition = FormStartPosition.CenterScreen;

            dlg.m_buttonDef    = buttons;
            dlg.m_defautButton = defaultbutton;

            dlg.button_texts = button_texts;

            dlg.ShowDialog(owner);

            bCheckBox = dlg.CheckBoxValue;
            return(dlg.DialogResult);
        }
Exemplo n.º 23
0
        public override void Draw(IRenderer renderer)
        {
            base.Draw(renderer);

            _mousePosition.SetText("MousePosition: " + ClientHardware.GetMousePosition().X + ", " +
                                   (ClientHardware.GetApplicationDisplaySize().Y - ClientHardware.GetMousePosition().Y));

            var elementsUnderMouse = ClientGuiStage.MouseInputProcessor.Result.GuiElementsUnderMouse;

            if (elementsUnderMouse.Count > 0)
            {
                var element = elementsUnderMouse[0];
                var path    = GuiUtil.GetGuiElementPath(element);
                _underMouse.SetText(
                    path + "\n" +
                    "\n" +
                    "DrawingGeometry: " + element.GetLayoutProcessingData().DrawingGeometry + "\n" +
                    "AbsoluteGeometry: " + element.GetLayoutProcessingData().AbsoluteGeometry + "\n" +
                    "ClipRect: " + element.GetLayoutProcessingData().ClipRect
                    );
            }
            else
            {
                _underMouse.SetText("NONE with MouseEnabled set to true");
            }
        }
Exemplo n.º 24
0
        private void button_findTarget_Click(object sender, System.EventArgs e)
        {
            OpenResDlg dlg = new OpenResDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Text           = "请选择目标数据库";
            dlg.EnabledIndices = new int[] { ResTree.RESTYPE_DB };
            dlg.ap             = this.AppInfo;
            dlg.ApCfgTitle     = "dbnamemapitemdlg_origin";
            dlg.MultiSelect    = false;

            // 如果目标textbox有内容,优先用它决定缺省选定的数据库节点。否则用源textbox的内容
            if (string.IsNullOrEmpty(this.textBox_target.Text) == false)
            {
                dlg.Path = this.textBox_target.Text;
            }
            else if (string.IsNullOrEmpty(this.textBox_origin.Text) == false)
            {
                dlg.Path = this.textBox_origin.Text;
            }

            dlg.Initial(this.Servers,
                        this.Channels);
            // dlg.StartPositon = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);   // 对于数据库节点,不要主动展开其下一级

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            textBox_target.Text = dlg.Path;
        }
Exemplo n.º 25
0
        void menu_modify(object sender, EventArgs e)
        {
            if (this.listView_map.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择要修改的事项");
                return;
            }

            DbNameMapItemDlg dlg = new DbNameMapItemDlg();

            dlg.Font        = GuiUtil.GetDefaultFont();
            dlg.SearchPanel = this.SearchPanel;
            dlg.Origin      = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[0].Text);
            dlg.Target      = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[1].Text);
            dlg.WriteMode   = this.listView_map.SelectedItems[0].SubItems[2].Text;

            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            this.listView_map.SelectedItems[0].SubItems[0].Text = ResPath.GetReverseRecordPath(dlg.Origin);
            this.listView_map.SelectedItems[0].SubItems[1].Text = ResPath.GetReverseRecordPath(dlg.Target);
            this.listView_map.SelectedItems[0].SubItems[2].Text = ResPath.GetReverseRecordPath(dlg.WriteMode);
        }
Exemplo n.º 26
0
        public static PictureView InsertIntoPanel(Panel panel)
        {
            PictureView pv = new PictureView();

            GuiUtil.InsertIntoPanel(pv, panel);
            return(pv);
        }
Exemplo n.º 27
0
        static string GetSplitContainerState(SplitContainer splitContainer)
        {
            Hashtable table = new Hashtable();

            table["ratio"]       = GuiUtil.GetSplitterState(splitContainer).ToString();
            table["orientation"] = splitContainer.Orientation == Orientation.Vertical ? "v" : "h";
            return(splitContainer.GetType().ToString() + ":" + StringUtil.BuildParameterString(table, ',', '=', "url"));
        }
Exemplo n.º 28
0
    /// <summary>
    /// Shows the version of the game.
    /// </summary>
    protected void showVersion()
    {
#if SHOW_VERSION
        var height = GuiUtil.GetScaledValue(30);
        GuiUtil.ChangeFont(GUI.skin.label, FONT_SIZE_X1, AtariPalette.Hue01Lum12, TextAnchor.UpperLeft);
        GUI.Label(new Rect(0, Screen.height - height, 500, height), Strings.VERSION);
#endif
    }
Exemplo n.º 29
0
        // GCAT通道登录 旧的方式
        public void gcat_channel_BeforeLogin(object sender,
                                             DigitalPlatform.GcatClient.BeforeLoginEventArgs e)
        {
            string strUserName = (string)this.DetailForm.MainForm.ParamTable["author_number_account_username"];
            string strPassword = (string)this.DetailForm.MainForm.ParamTable["author_number_account_password"];

            if (String.IsNullOrEmpty(strUserName) == true)
            {
                strUserName = "******";
                strPassword = "";
            }

            // 直接试探
            if (!(e.UserName == strUserName && e.Failed == true) &&
                strUserName != "")
            {
                e.UserName = strUserName;
                e.Password = strPassword;
                return;
            }

            LoginDlg dlg = new LoginDlg();

            GuiUtil.SetControlFont(dlg, this.DetailForm.MainForm.Font);

            if (e.Failed == true)
            {
                dlg.textBox_comment.Text = "登录失败。加著者号码功能需要重新登录";
            }
            else
            {
                dlg.textBox_comment.Text = "加著者号码功能需要登录";
            }

            dlg.textBox_serverAddr.Text       = e.GcatServerUrl;
            dlg.textBox_userName.Text         = strUserName;
            dlg.textBox_password.Text         = strPassword;
            dlg.checkBox_savePassword.Checked = true;

            dlg.textBox_serverAddr.Enabled = false;
            dlg.TopMost = true; // 2009/11/12 因为ShowDialog(null),为了防止对话框被放在非顶部
            dlg.ShowDialog(null);
            if (dlg.DialogResult != DialogResult.OK)
            {
                e.Cancel = true;    // 2009/11/12 如果缺这一句,会造成Cancel后仍然重新弹出登录对话框
                return;
            }

            strUserName = dlg.textBox_userName.Text;
            strPassword = dlg.textBox_password.Text;

            e.UserName = strUserName;
            e.Password = strPassword;

            this.DetailForm.MainForm.ParamTable["author_number_account_username"] = strUserName;
            this.DetailForm.MainForm.ParamTable["author_number_account_password"] = strPassword;
        }
Exemplo n.º 30
0
        private void btnDownloadArchiveBrowse_Click(object sender, EventArgs e)
        {
            string filepath = GuiUtil.SelectFile(this, Localization.GetString("msg.select_download_archive_file.title", "Select download archive..."), "Text Files (*.txt)|*.txt|All Files (*.*)|*.*", txtDownloadArchive.Text, false);

            if (filepath != null)
            {
                txtDownloadArchive.Text = filepath;
            }
        }