예제 #1
0
 public GetRemoteRuleWindow(FreeHttpWindow freeHttpWindow, ShowRuleCollectionType expectType = ShowRuleCollectionType.RemoteRule)
 {
     InitializeComponent();
     nowShowType = expectType;
     mainWindow  = freeHttpWindow;
     lv_remote_requestRuleList.SmallImageList  = mainWindow.imageList_forTab;
     lv_remote_responseRuleList.SmallImageList = mainWindow.imageList_forTab;
     loadWindowService = new LoadWindowService();
 }
예제 #2
0
        private void ShowInfoChange(ShowRuleCollectionType showParameter)
        {
            ClearRemoteRule();
            switch (showParameter)
            {
            case ShowRuleCollectionType.RemoteRule:
                nowShowType = ShowRuleCollectionType.RemoteRule;
                lb_info_RemoteRule.ForeColor = Color.SaddleBrown;
                lb_info_SharedRule.ForeColor = lb_info_LocalRule.ForeColor = Color.DarkGray;
                lb_info_RemoteRule.BackColor = Color.LavenderBlush;
                lb_info_SharedRule.BackColor = lb_info_LocalRule.BackColor = Color.FromArgb(194, 217, 247);

                lb_info_1.Text    = "remote rule token:";
                lb_info_1.Visible = true;
                watermakTextBox_ruleToken.Visible = true;
                bt_getRule.Visible                    = true;
                lv_shareRuleList.Visible              = false;
                lv_remote_requestRuleList.Location    = lv_requestRuleOriginLocation;
                lv_remote_requestRuleList.Height      = lv_requestRuleOriginHeight;
                lv_remote_requestRuleList.Width       = lv_requestRuleOriginWidth;
                lv_remote_responseRuleList.Location   = lv_responseRuleOriginLocation;
                lv_remote_responseRuleList.Width      = lv_requestRuleOriginWidth;
                lv_remote_requestRuleList.CheckBoxes  = false;
                lv_remote_responseRuleList.CheckBoxes = false;
                ClearShowShareTakenItemBackColor();
                bt_merge.Text      = "Merge Remote Rule";
                bt_replace.Visible = true;
                break;

            case ShowRuleCollectionType.SharedRule:
                nowShowType = ShowRuleCollectionType.SharedRule;
                lb_info_SharedRule.ForeColor = Color.SaddleBrown;
                lb_info_RemoteRule.ForeColor = lb_info_LocalRule.ForeColor = Color.DarkGray;
                lb_info_SharedRule.BackColor = Color.LavenderBlush;
                lb_info_RemoteRule.BackColor = lb_info_LocalRule.BackColor = Color.FromArgb(194, 217, 247);

                lb_info_1.Visible = false;
                watermakTextBox_ruleToken.Visible = false;
                bt_getRule.Visible                 = true;
                lv_shareRuleList.Visible           = true;
                lv_remote_requestRuleList.Location = new Point(lv_requestRuleOriginLocation.X + lv_shareRuleList.Width, lv_requestRuleOriginLocation.Y - 40);
                lv_remote_requestRuleList.Height   = lv_requestRuleOriginHeight + 40;
                lv_remote_requestRuleList.Width    = lv_requestRuleOriginWidth - lv_shareRuleList.Width;

                lv_remote_responseRuleList.Location   = new Point(lv_responseRuleOriginLocation.X + lv_shareRuleList.Width, lv_responseRuleOriginLocation.Y);
                lv_remote_responseRuleList.Width      = lv_requestRuleOriginWidth - lv_shareRuleList.Width;
                lv_remote_requestRuleList.CheckBoxes  = false;
                lv_remote_responseRuleList.CheckBoxes = false;
                bt_merge.Text      = "Merge Share Rule";
                bt_replace.Visible = true;
                break;

            case ShowRuleCollectionType.LocalRule:
                nowShowType = ShowRuleCollectionType.LocalRule;
                lb_info_LocalRule.ForeColor  = Color.SaddleBrown;
                lb_info_RemoteRule.ForeColor = lb_info_SharedRule.ForeColor = Color.DarkGray;
                lb_info_LocalRule.BackColor  = Color.LavenderBlush;
                lb_info_RemoteRule.BackColor = lb_info_SharedRule.BackColor = Color.FromArgb(194, 217, 247);

                lb_info_1.Visible = false;
                watermakTextBox_ruleToken.Visible = false;
                bt_getRule.Visible                 = false;
                lv_shareRuleList.Visible           = false;
                lv_remote_requestRuleList.Location = new Point(lv_requestRuleOriginLocation.X, lv_requestRuleOriginLocation.Y - 40);
                lv_remote_requestRuleList.Height   = lv_requestRuleOriginHeight + 40;
                lv_remote_requestRuleList.Width    = lv_requestRuleOriginWidth;

                lv_remote_responseRuleList.Location   = lv_responseRuleOriginLocation;
                lv_remote_responseRuleList.Width      = lv_requestRuleOriginWidth;
                lv_remote_requestRuleList.CheckBoxes  = true;
                lv_remote_responseRuleList.CheckBoxes = true;
                ClearShowShareTakenItemBackColor();
                bt_merge.Text      = "Save Share Rule";
                bt_replace.Visible = false;
                //action
                LoadRules(localRuleDetails);
                break;

            default:
                MessageBox.Show("nonsupport static data type");
                break;
            }
        }