Beispiel #1
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (!_systemExit)
            {
                var view = _viewFactory.GetView <ViewMainCloseConfirm>();
                if (view.ShowDialog(this) != DialogResult.OK)
                {
                    e.Cancel = true;
                }
            }

            base.OnFormClosing(e);

            if (!e.Cancel)
            {
                switch (e.CloseReason)
                {
                case CloseReason.ApplicationExitCall:
                case CloseReason.TaskManagerClosing:
                case CloseReason.UserClosing:
                case CloseReason.WindowsShutDown:
                    _globalApplicationData.ApplicationData.UserExit = true;
                    break;
                }
            }
        }
Beispiel #2
0
        private void LoginViewModelOnSignIn(object sender, SignInEventArgs args)
        {
            if (!args.Result.Success)
            {
                ShowError(args.Result.Message);
                return;
            }

            if (args.ChatViewModel != null)
            {
                var chatWindow = new ClientWindow
                {
                    DataContext          = args.ChatViewModel,
                    ContentControl       = { Content = _viewFactory.GetView(args.ChatViewModel) },
                    MinWidth             = 300,
                    MinHeight            = 150,
                    Width                = 600,
                    Height               = 400,
                    ResizeMode           = ResizeMode.CanResize,
                    ShowMaxRestoreButton = true,
                    Title                = args.ChatViewModel.Title
                };

                chatWindow.Closed += new OneTimeEventHandler(() =>
                {
                    Application.Current.MainWindow.Show();
                    ((LoginViewModel)DataContext).Reload();
                });

                Application.Current.MainWindow.Hide();
                chatWindow.Show();
            }
        }
Beispiel #3
0
        public void Write(string mimeType, T resource)
        {
            var view = _factory.GetView();

            view.Page.ServiceLocator = _services;
            view.Render();

            _writer.ContentType(MimeType.Html);
        }
Beispiel #4
0
        public IRenderableView BuildView()
        {
            if (_headers.IsAjaxRequest() || _chains.IsInPartial())
            {
                return(_factory.GetPartialView());
            }

            return(_factory.GetView());
        }
Beispiel #5
0
        void Init()
        {
            sdgvShopList.AutoGenerateColumns = false;
            sbtnAdd.Click += (sender, e) =>
            {
                var view = _viewFacktory.GetView <ViewAddShop>();
                view.ShowDialog(this);
            };

            sbtnDelete.Click += (sender, e) =>
            {
                if (sdgvShopList.SelectedRows.Count == 0 || sdgvShopList.SelectedRows[0].IsNewRow)
                {
                    MessageBoxEx.Show(this, "请选择需要删除的店铺信息!",
                                      "删除店铺信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                int id = (int)sdgvShopList.SelectedRows[0].Cells["ColId"].Value;
                _shopBll.Delete(new Shop {
                    Id = id
                }, state =>
                {
                    string info = string.Empty;
                    switch (state)
                    {
                    case ShopOptState.CannotConnectServer:
                        info = "服务器连接失败,未能删除店铺信息!";
                        break;

                    case ShopOptState.Failed:
                        info = "服务器异常,删除店铺信息失败!";
                        break;

                    case ShopOptState.InvalidOpt:
                        info = "非法操作!与服务器连接断开,请稍后重试!";
                        break;

                    case ShopOptState.Successed:
                        info = "删除店铺信息成功!";
                        break;
                    }

                    Invoke(() =>
                    {
                        MessageBoxEx.Show(this, info, "删除店铺信息",
                                          MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (state == ShopOptState.Successed)
                        {
                            BindShopList();
                        }
                    });
                });
            };
        }
Beispiel #6
0
        protected override DoNext performInvoke()
        {
            var view = _factory.GetView();

            view.Page.ServiceLocator = _services;
            view.Render();

            _writer.ContentType(MimeType.Html);

            return(DoNext.Continue);
        }
        private void ExecuteCommand(object sender, EventArgs e)
        {
            var command = (OleMenuCommand)sender;

            Debug.WriteLine($"ExecuteCommand {command.Text} {command.CommandID.ID} ");
            try
            {
                switch ((uint)command.CommandID.ID)
                {
                case PackageCommanddIDs.CreateSnippet:
                    var selection = DTE.ActiveDocument.Selection as TextSelection;
                    if (selection != null)
                    {
                        var dialog = _viewFactory.GetView <Dialog>(ViewTypes.CreateSnippet);
                        var cs     = (CreateSnippet)dialog;
                        var csm    = cs.DataContext as CreateSnippetViewModel;
                        csm.Code     = selection.Text;
                        csm.FileName = new System.IO.FileInfo(DTE.ActiveDocument.FullName).Name;
                        _shell.ShowDialog(Strings.OpenOnGitLabPackage_CreateSnippet, dialog);
                    }
                    else
                    {
                        Debug.Write("未选择任何内容");
                    }
                    break;

                default:
                    using (var git = new GitAnalysis(GetActiveFilePath()))
                    {
                        if (!git.IsDiscoveredGitRepository)
                        {
                            return;
                        }
                        var selectionLineRange = GetSelectionLineRange();
                        var type      = ToGitLabUrlType(command.CommandID.ID);
                        var GitLabUrl = git.BuildGitLabUrl(type, selectionLineRange);
                        System.Diagnostics.Process.Start(GitLabUrl);     // open browser
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
            }
        }
Beispiel #8
0
        public void Open(object viewKey, Argument argument = null)
        {
            if (!_items.ContainsKey(viewKey))
            {
                throw new Exception(string.Format("{0} has not been mapped", viewKey));
            }
            if (_opened.ContainsKey(viewKey))
            {
                throw new Exception(string.Format("{0} is already opened", viewKey));
            }

            MediatorItem item = _items[viewKey];

            var    mediator = Activator.CreateInstance(item.mediatorType);
            object view     = _viewFactory.GetView(item.viewType);

            _opened.Add(viewKey, new ViewItem {
                mediator = mediator, view = view
            });

            item.viewField.SetValue(mediator, view);

            if (_injector != null)
            {
                _injector.Inject(mediator, InjectionMode.ResolveOnly);
            }

            if (item.argumentField != null)
            {
                item.argumentField.SetValue(mediator, argument);
            }

            if (item.openMethod != null)
            {
                item.openMethod.Invoke(mediator, null);
            }
        }
Beispiel #9
0
 public void Render()
 {
     _viewFactory.GetView().Render();
 }
Beispiel #10
0
        private void ExecuteCommand(object sender, EventArgs e)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            var command = (OleMenuCommand)sender;

            try
            {
                switch ((uint)command.CommandID.ID)
                {
                case PackageIds.OpenFromUrl:
                    if (Clipboard.ContainsText(TextDataFormat.Text))
                    {
                        var match = Regex.Match(Clipboard.GetText(TextDataFormat.Text), "[a-zA-z]+://[^\\s]*");
                        if (match.Success)
                        {
                            try
                            {
                                TryOpenFile(match.Value);
                            }
                            catch (Exception ex)
                            {
                                OutputWindowHelper.ExceptionWriteLine(string.Format("Can't Open {0},Exception:{1}", match.Value, ex.Message), ex);
                            }
                        }
                    }
                    break;

                case PackageIds.OpenBlame:
                case PackageIds.OpenBranch:
                case PackageIds.OpenCommits:
                case PackageIds.OpenMaster:
                case PackageIds.OpenRevision:
                case PackageIds.OpenRevisionFull:
                case PackageIds.OpenWebIDE:
                {
                    try
                    {
                        using (var git = new GitAnalysis(GetActiveFilePath()))
                        {
                            if (!git.IsDiscoveredGitRepository)
                            {
                                return;
                            }
                            var selectionLineRange = GetSelectionLineRange();
                            var type     = ToGiteaUrlType(command.CommandID.ID);
                            var GiteaUrl = git.BuildGiteaUrl(type, selectionLineRange);
                            System.Diagnostics.Process.Start(GiteaUrl);         // open browser
                        }
                    }
                    catch (Exception ex)
                    {
                        OutputWindowHelper.ExceptionWriteLine(string.Format("ExecuteCommand {0}", command.CommandID.ID, ex.Message), ex);
                    }
                }
                break;

                case PackageIds.OpenCreateSnippet:
                    var selection = DTE.ActiveDocument.Selection as TextSelection;
                    if (selection != null)
                    {
                        var dialog = _viewFactory.GetView <Dialog>(ViewTypes.CreateSnippet);
                        var cs     = (CreateSnippet)dialog;
                        var csm    = cs.DataContext as CreateSnippetViewModel;
                        csm.Code     = selection.Text;
                        csm.FileName = new FileInfo(DTE.ActiveDocument.FullName).Name;
                        csm.Desc     = csm.FileName;
                        _shell.ShowDialog(Strings.CreateSnippet, dialog);
                    }
                    else
                    {
                        OutputWindowHelper.DiagnosticWriteLine(Strings.PleaseSelectCode);
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
            }
        }
        private void OnLogin()
        {
            var dialog = _viewFactory.GetView <Dialog>(ViewTypes.Login);

            _shell.ShowDialog(string.Format(Strings.Login_ConnectTo, Strings.Name), dialog);
        }
Beispiel #12
0
        void Init()
        {
            SetToMax();

            _orderRecordControl      = new OrderRecordListControl(_shopBll, _orderStateBll);
            _orderRecordControl.Dock = DockStyle.Fill;
            tpShippingList.Controls.Add(_orderRecordControl);

            skinTabControl.SelectedIndexChanged += (sender, e) =>
            {
                if (skinTabControl.SelectedIndex == 1 &&
                    !_remoteDeskConnectState.Connected)
                {
                    LoadOrderRecordPageList(1,
                                            _orderRecordControl.PaginationOrderRecordList.PageSize);
                }
            };

            _remoteDeskConnectState = new RemoteDeskConnectState();
            _remoteDeskCheckTimer   = new System.Threading.Timer(
                RemoteDeskCheckTimerCallback, null, Timeout.Infinite, 2000);

            sdgvSubAccountList.AutoGenerateColumns = false;
            sdgvSubAccountList.CellFormatting     += (sender, e) =>
            {
                switch (e.ColumnIndex)
                {
                case 1:
                    string acc = e.Value as string;
                    if (!string.IsNullOrEmpty(acc))
                    {
                        int result;
                        int markCount = Math.DivRem(acc.Length, 2, out result);
                        if (result != 0)
                        {
                            markCount++;
                        }

                        var accArray = acc.ToCharArray();
                        for (int i = 1; i <= markCount; i += 1)
                        {
                            accArray[acc.Length - i] = '*';
                        }

                        e.Value = new string(accArray);
                    }
                    break;

                case 2:
                    byte?index = (byte?)e.Value;
                    if (index.HasValue)
                    {
                        e.Value = ConstData.TaoBaoLevels[index.Value - 1].Name;
                    }
                    break;

                case 3:
                    bool?sex = (bool?)e.Value;
                    if (sex.HasValue)
                    {
                        e.Value = sex.Value ? "男" : "女";
                    }
                    break;

                case 5:
                    var data = sdgvSubAccountList.DataSource as IList <UserSubAccountPageListVM>;
                    if (data != null && data.Count > e.RowIndex)
                    {
                        var vm = data[e.RowIndex];
                        e.Value = string.Format("{0} - {1} - {2}", vm.Province, vm.City, vm.District);
                    }
                    break;

                case 8:
                    if ((bool)e.Value)
                    {
                        e.Value = "在线";
                        e.CellStyle.BackColor          = Color.Green;
                        e.CellStyle.SelectionBackColor = Color.Green;
                    }
                    else
                    {
                        e.Value = "离线";
                        e.CellStyle.BackColor          = Color.Red;
                        e.CellStyle.SelectionBackColor = Color.Red;
                    }
                    break;

                case 9:
                    if (e.Value == null)
                    {
                        e.Value = "未连接";
                    }

                    if (e.Value.ToString().Equals("正在连接"))
                    {
                        e.CellStyle.BackColor          = Color.Yellow;
                        e.CellStyle.SelectionBackColor = Color.Yellow;
                        e.CellStyle.ForeColor          = Color.Red;
                        e.CellStyle.SelectionForeColor = Color.Red;
                    }
                    break;

                case 10:
                    if (e.Value == null)
                    {
                        e.Value = "连接";
                    }
                    break;

                case 11:
                    int?dayCount = e.Value as int?;
                    if (dayCount.HasValue && dayCount.Value >= 3)
                    {
                        e.CellStyle.BackColor =
                            e.CellStyle.SelectionBackColor = Color.Red;
                    }
                    break;

                case 13:
                    var orderTypeDetailsList = e.Value as IList <OrderTypeDetails>;
                    if (orderTypeDetailsList != null && orderTypeDetailsList.Count > 0)
                    {
                        StringBuilder orderTypeSb = new StringBuilder();
                        foreach (var orderTypeDetails in orderTypeDetailsList)
                        {
                            orderTypeSb.AppendFormat("{0}({1}) ",
                                                     orderTypeDetails.Name, orderTypeDetails.Count);
                        }
                        e.Value = orderTypeSb.ToString();
                    }
                    else
                    {
                        e.Value = string.Empty;
                    }
                    break;
                }
            };

            sdgvSubAccountList.CellContentClick += (sender, e) =>
            {
                if (e.RowIndex == -1)
                {
                    return;
                }

                if (e.ColumnIndex == 10)
                {
                    var row   = sdgvSubAccountList.Rows[e.RowIndex];
                    var value = row.Cells[e.ColumnIndex].FormattedValue.ToString();
                    if (string.Equals(value, "连接"))
                    {
                        if (_remoteDeskConnectState.Connected)
                        {
                            MessageBoxEx.Show(this,
                                              "已经连接挂机端操作,不能同时进行多个连接操作!",
                                              "连接挂机端",
                                              MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        //开始连接前,关闭所有连接窗口。
                        while (AnyDesk.IsClientOpened())
                        {
                            AnyDesk.CloseClient();
                        }

                        if ((bool)row.Cells[8].Value)
                        {
                            _remoteDeskConnectState.Connected = true;
                            var view = _viewFactory.GetView <ViewReadyConnectClient>();
                            view.Model = row.DataBoundItem as UserSubAccountPageListVM;
                            if (view.ShowDialog(this) != DialogResult.OK)
                            {
                                _remoteDeskConnectState.Connected = false;
                            }
                        }
                        else
                        {
                            MessageBoxEx.Show(this,
                                              "该挂机端不在线,不能连接!\r\n\r\n可尝试刷新挂机端信息后,再进行操作。",
                                              "连接挂机端",
                                              MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else
                    {
                        while (AnyDesk.IsClientOpened())
                        {
                            AnyDesk.CloseClient();
                        }
                        StartOrderRecord();
                    }
                }
            };

            scbProvince.SelectedIndexChanged += (sender, e) =>
            {
                if (scbProvince.SelectedIndex != -1)
                {
                    var value = scbProvince.SelectedItem as Province;
                    if (value.ProvinceID != -1)
                    {
                        scbCity.DisplayMember = "CityName";
                        scbCity.DataSource    = _areaBll.GetCityList(value.ProvinceID);
                    }
                    else
                    {
                        scbCity.DataSource     = null;
                        scbDistrict.DataSource = null;
                    }
                }
                else
                {
                    scbCity.DataSource     = null;
                    scbDistrict.DataSource = null;
                }
            };

            scbCity.SelectedIndexChanged += (sender, e) =>
            {
                if (scbCity.SelectedIndex != -1)
                {
                    var value = scbCity.SelectedItem as City;
                    if (value.CityID != -1)
                    {
                        scbDistrict.DisplayMember = "DistrictName";
                        scbDistrict.DataSource    = _areaBll.GetDistrictList(value.CityID);
                    }
                    else
                    {
                        scbDistrict.DataSource = null;
                    }
                }
                else
                {
                    scbDistrict.DataSource = null;
                }
            };

            tsmiSubAccManage.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewSubAccountManage>();
                view.ShowDialog(this);
            };

            tsmiShopManage.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewShopManage>();
                view.ShowDialog(this);
            };

            tsmiAccountInfo.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewUserInfo>();
                view.ShowDialog(this);
            };

            tsmiChangePwd.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewChangePassword>();
                view.ShowDialog(this);
            };

            tsmiAbout.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewAbout>();
                view.ShowDialog(this);
            };

            paginationSubAccount.Reload += (sender, e) =>
            {
                LoadSubAccountPageList(
                    paginationSubAccount.PageIndex, paginationSubAccount.PageSize);
            };

            sbtnSearch.Click += (sender, e) =>
            {
                LoadSubAccountPageList(
                    1, paginationSubAccount.PageSize);
            };
        }
        private void OnClone()
        {
            var dialog = _viewFactory.GetView <Dialog>(ViewTypes.Clone);

            _shell.ShowDialog(Strings.Common_Clone, dialog);
        }
Beispiel #14
0
        void InitEvents()
        {
            stbPassword.IconClick += delegate
            {
                PassKey passKey = new PassKey(
                    Left + stbPassword.Left,
                    Top + stbPassword.Bottom,
                    stbPassword.SkinTxt);
                passKey.Show(this);
            };

            checkBoxRememberPwd.CheckedChanged += (sender, e) =>
            {
                if (!checkBoxRememberPwd.Checked)
                {
                    checkBoxAutoLogin.Checked = false;
                }
            };

            checkBoxAutoLogin.CheckedChanged += (sender, e) =>
            {
                if (checkBoxAutoLogin.Checked)
                {
                    checkBoxRememberPwd.Checked = true;
                }
            };

            EventHandler btnMouseEnter = (sender, e) =>
            {
                var control = sender as Control;
                control.ForeColor = Color.FromArgb(98, 180, 247);
            };

            EventHandler btnMouseLeave = (sender, e) =>
            {
                var control = sender as Control;
                control.ForeColor = Color.FromArgb(39, 134, 228);
            };

            EventHandler tbFocus = (sender, e) =>
            {
                var control = sender as Control;
                errorProvider.SetError(control.Parent, string.Empty);
            };

            btnRegister.MouseEnter       += btnMouseEnter;
            btnForgotPassword.MouseEnter += btnMouseEnter;
            btnRegister.MouseLeave       += btnMouseLeave;
            btnForgotPassword.MouseLeave += btnMouseLeave;

            stbAccount.SkinTxt.GotFocus  += tbFocus;
            stbPassword.SkinTxt.GotFocus += tbFocus;

            btnLogin.Click    += btnLogin_Click;
            btnRegister.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewRegister>();
                view.ShowDialog(this);
            };
            btnForgotPassword.Click += (sender, e) =>
            {
                MessageBoxEx.Show(this, "请联系管理员!", "忘记密码",
                                  MessageBoxButtons.OK, MessageBoxIcon.Information);
            };
        }
Beispiel #15
0
        private void ExecuteCommand(object sender, EventArgs e)
        {
            var command = (OleMenuCommand)sender;

            try
            {
                switch ((uint)command.CommandID.ID)
                {
                case PackageIds.OpenCreateSnippet:
                    var selection = DTE.ActiveDocument.Selection as TextSelection;
                    if (selection != null)
                    {
                        var dialog = _viewFactory.GetView <Dialog>(ViewTypes.CreateSnippet);
                        var cs     = (CreateSnippet)dialog;
                        var csm    = cs.DataContext as CreateSnippetViewModel;
                        csm.Code     = selection.Text;
                        csm.FileName = new System.IO.FileInfo(DTE.ActiveDocument.FullName).Name;
                        _shell.ShowDialog(Strings.OpenOnGitLabPackage_CreateSnippet, dialog);
                    }
                    else
                    {
                        OutputWindowHelper.DiagnosticWriteLine(GitLab.VisualStudio.Shared.Strings.PleaseCodes);
                    }
                    break;

                case PackageIds.OpenFromUrl:

                    if (Clipboard.ContainsText(TextDataFormat.Text))
                    {
                        var match = Regex.Match(Clipboard.GetText(TextDataFormat.Text), "[a-zA-z]+://[^\\s]*");
                        if (match.Success)
                        {
                            try
                            {
                                TryOpenFile(match.Value);
                            }
                            catch (Exception ex)
                            {
                                OutputWindowHelper.ExceptionWriteLine(string.Format(GitLab.VisualStudio.Shared.Strings.Canotopenurl, match.Value, ex.Message), ex);
                            }
                        }
                    }
                    break;

                default:
                    using (var git = new GitAnalysis(GetActiveFilePath()))
                    {
                        if (!git.IsDiscoveredGitRepository)
                        {
                            return;
                        }
                        var selectionLineRange = GetSelectionLineRange();
                        var type      = ToGitLabUrlType(command.CommandID.ID);
                        var GitLabUrl = git.BuildGitLabUrl(type, selectionLineRange);
                        System.Diagnostics.Process.Start(GitLabUrl);     // open browser
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                OutputWindowHelper.ExceptionWriteLine($"Command:{command.Text},Message:{ex.Message}", ex);
            }
        }
Beispiel #16
0
        void Init()
        {
            sdgvSubAccountList.AutoGenerateColumns = false;
            sdgvSubAccountList.CellFormatting     += (sender, e) =>
            {
                switch (e.ColumnIndex)
                {
                case 2:
                    byte?value = e.Value as byte?;
                    if (value.HasValue)
                    {
                        e.Value = ConstData.TaoBaoLevels[value.Value - 1].Name;
                    }
                    break;
                }
            };

            sbtnAdd.Click += (sender, e) =>
            {
                var view = _viewFacktory.GetView <ViewAddSubAccount>();
                view.ShowDialog(this);
            };

            sbtnUpdate.Click += (sender, e) =>
            {
                if (sdgvSubAccountList.SelectedRows.Count == 0 || sdgvSubAccountList.SelectedRows[0].IsNewRow)
                {
                    MessageBoxEx.Show(this, "请选择需要修改信息的小号!",
                                      "修改小号信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                var view = _viewFacktory.GetView <ViewUpdateSubAccount>();
                view.SubAccount = sdgvSubAccountList.SelectedRows[0].DataBoundItem as UserSubAccount;
                view.ShowDialog(this);
            };

            sbtnDelete.Click += (sender, e) =>
            {
                if (sdgvSubAccountList.SelectedRows.Count == 0 || sdgvSubAccountList.SelectedRows[0].IsNewRow)
                {
                    MessageBoxEx.Show(this, "请选择需要删除的小号信息!",
                                      "删除小号信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                int id = (int)sdgvSubAccountList.SelectedRows[0].Cells["ColId"].Value;
                _subAccountBll.Delete(new UserSubAccount {
                    Id = id
                }, state =>
                {
                    string info = string.Empty;
                    switch (state)
                    {
                    case UserSubAccountOptState.CannotConnectServer:
                        info = "服务器连接失败,未能删除小号信息!";
                        break;

                    case UserSubAccountOptState.Failed:
                        info = "服务器异常,删除小号信息失败!";
                        break;

                    case UserSubAccountOptState.InvalidOpt:
                        info = "非法操作!与服务器连接断开,请稍后重试!";
                        break;

                    case UserSubAccountOptState.Successed:
                        info = "删除小号信息成功!";
                        break;
                    }

                    Invoke(() =>
                    {
                        MessageBoxEx.Show(this, info, "删除小号信息",
                                          MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (state == UserSubAccountOptState.Successed)
                        {
                            BindUserSubAccountList();
                        }
                    });
                });
            };
        }
        public ViewConfirmReceipt(IViewFactory viewFactory)
        {
            _viewFactory = viewFactory;
            InitializeComponent();
            SetToMax();

            timerInputKey.Tick += (sender, e) =>
            {
                if (!webBrowser.Focused)
                {
                    return;
                }

                string pwd = TripleDES.Decrypt3DES(ConfirmReceiptInfo.PayPassWord);
                foreach (char ch in pwd.ToUpper().ToCharArray())
                {
                    Keys keyCode = (Keys)ch;
                    KeyBoardHook.Key(keyCode);
                }

                timerInputKey.Stop();
                stbUrl.Visible = true;
            };

            sbtnGoto.Click += (sender, e) =>
            {
                webBrowser.Navigate(stbUrl.SkinTxt.Text);
            };

            sbtnBrowserSet.Click += (sender, e) =>
            {
                var view = _viewFactory.GetView <ViewBrowserSet>();
                view.ShowDialog(this);
                webBrowser.Refresh();
            };

            sbtnInpuPassword.Click += (sender, e) =>
            {
                string url = webBrowser.Url.ToString().ToLower();

                if (url.IndexOf("trade") <= 0)
                {
                    MessageBoxEx.Show(this, "\r\n    请求的地址错误!    \r\n", "输入支付密码");
                    return;
                }

                if (url.IndexOf(ConfirmReceiptInfo.OrderNum) <= 0)
                {
                    MessageBoxEx.Show(this, "\r\n    请求的订单号错误!    \r\n", "输入支付密码");
                    return;
                }

                if (url.IndexOf("https://trade.taobao.com/trade/confirm_goods.htm") != 0 &&
                    url.IndexOf("https://trade.1688.com/order/trade_flow.htm") != 0 &&
                    url.IndexOf("https://trade.tmall.com/order/confirmgoods.htm") != 0)
                {
                    MessageBoxEx.Show(this, "\r\n    请求的地址错误!    \r\n", "输入支付密码");
                    return;
                }

                base.TopMost   = true;
                stbUrl.Visible = false;
                timerInputKey.Start();
            };

            webBrowser.NewWindow3 += (sender, e) =>
            {
                e.Cancel = true;
                webBrowser.Navigate(e.Url);
            };
        }
Beispiel #18
0
        public override void Connect()
        {
            var dialog = _viewFactory.GetView <Dialog>(ViewTypes.Login);

            _shell.ShowDialog(string.Format(Strings.Login_ConnectTo, Strings.Name), dialog);
        }
Beispiel #19
0
 protected override Page CreateDefault(object item)
 {
     return(ShellViewPage.Create(viewFactory.GetView(item as IViewModel)));
 }