Exemplo n.º 1
0
        private void RenameStrip_Click(object sender, EventArgs e)
        {
            GetForm.SetNativeEnabled(false);

            TextInput.GetInput("Enter a new name for your folder.",
                               "Rename",
                               newName =>
            {
                GetForm.SetNativeEnabled(true);

                if (newName != "")
                {
                    try
                    {
                        Directory.Move(Dir + PanelName, Dir + newName);

                        ChangeName(newName);
                    }
                    catch (Exception ex)
                    {
                        Helper.Error("Error renaming file.", ex.Message);
                    }
                }
            },
                               PanelName,
                               x => TextInput.dirNameValid(x) && !Directory.Exists(Dir + x));
        }
Exemplo n.º 2
0
        private void RenameStrip_Click(object sender, EventArgs e)
        {
            GetForm.SetNativeEnabled(false);

            TextInput.GetInput("Enter a new name for your file.",
                               "Rename",
                               newName =>
            {
                GetForm.SetNativeEnabled(true);

                if (newName != "")
                {
                    try
                    {
                        File.Move(Dir + PanelName,
                                  Dir + newName);

                        ChangeName(newName);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.ShowWait($"Error renaming file." +
                                        $"\n\n" +
                                        $"Reason: {ex.Message}",
                                        "Error",
                                        MsgBox.Options.ok,
                                        MsgBox.MsgIcon.ERROR);
                    }
                }
            },
                               PanelName,
                               x => TextInput.dirNameValid(x) && !Exists(Dir + x));
        }
 public void ShowPrintForm(Guid entityId)
 {
     if (GetForm == null)
     {
         return;
     }
     ReportViewer1.Report = GetForm.Invoke(entityId);
 }
Exemplo n.º 4
0
 public override void OnClick()
 {
     GetForm.BeginEditing($"{Dir}{PanelName}");
     new Document(PanelName, Dir).Start(() =>
     {
         GetForm.StopEditing($"{Dir}{PanelName}");
     });
 }
Exemplo n.º 5
0
        public override void Edit()
        {
            GetForm.BeginEditing($"{Dir}{PanelName}");

            Flashcards.Edit(PanelName, Dir, (n, d) =>
            {
                GetForm.StopEditing($"{Dir}{PanelName}");
            });
        }
Exemplo n.º 6
0
 public override void StartAssessment(Action onFinish)
 {
     GetForm.BeginEditing($"{Dir}{PanelName}");
     new Flashcards(PanelName, Dir).Start(() =>
     {
         GetForm.StopEditing($"{Dir}{PanelName}");
         onFinish?.Invoke();
     });
 }
Exemplo n.º 7
0
        public override void Duplicate()
        {
            GetForm.BeginEditing(Dir);
            GetForm.SetNativeEnabled(false);

            Flashcards.Duplicate(PanelName, Dir,
                                 () => GetForm.SetNativeEnabled(true),
                                 (n, d) =>
            {
                GetForm.StopEditing(Dir);
                if (n != "" && d == Dir)
                {
                    GetForm.AddPanel(new FlashcardsPanel(owner, n, Dir), true);
                }
            });
        }
Exemplo n.º 8
0
        private void DuplicateStrip_Click(object sender, EventArgs e)
        {
            GetForm.BeginEditing(Dir);
            GetForm.SetNativeEnabled(false);

            Document.Duplicate(PanelName, Dir,
                               () => GetForm.SetNativeEnabled(true),
                               (n, d) =>
            {
                GetForm.StopEditing(Dir);
                if (n != "" && d == Dir)
                {
                    GetForm.AddPanel(new DocumentPanel(owner, n, Dir), true);
                }
            });
        }
Exemplo n.º 9
0
        private void DoFormat(UKeyInfo ukeyInfoHT)
        {
            try
            {
                uint iRet = sm2Enroll.SetUSBKeyType(ukeyInfoHT.AppName, UKeyInfo.SM2, ukeyInfoHT.UKeyType);
                if (iRet == 0)
                {
                    GetForm g = new GetForm(GetForm1);
                    System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(g));
                    t.Start();

                    iRet = sm2Enroll.FormatUSBKey();
                    //System.Threading.Thread.Sleep(2000);
                    if (iRet == 0)
                    {
                        log.Log("格式化成功!");
                        System.Threading.Thread t1 = new System.Threading.Thread(new System.Threading.ThreadStart(g));
                        t1.Start();

                        bool bSucc = CreateUSBApp(ukeyInfoHT);
                        if (bSucc)
                        {
                            log.Log("创建应用成功!");
                        }
                        else
                        {
                            log.Log("创建应用出错,错误代码:" + sm2Enroll.GetErrorCode().ToString() + ",错误信息:" + sm2Enroll.GetErrorMsg() + ",请用UKEY对应的格式化工具格式化。");
                        }
                    }
                    else
                    {
                        log.Log("格式化出错,错误代码:" + sm2Enroll.GetErrorCode().ToString() + ",错误信息:" + sm2Enroll.GetErrorMsg() + ",请用UKEY对应的格式化工具格式化。");
                    }
                }
                else
                {
                    log.Log("加载IDAEnroll出错,错误代码:" + sm2Enroll.GetErrorCode().ToString() + ",错误信息:" + sm2Enroll.GetErrorMsg());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 10
0
        public override void OnClick()
        {
            string s = GetForm.CurrentDirectory;

            GetForm.OpenDir(s + ((s != "") ? "/" : "") + PanelName);
        }
Exemplo n.º 11
0
 private void MoveStrip_Click(object sender, EventArgs e)
 {
     GetForm.BeginMove(this);
 }
        /// <summary>
        /// Get Async get request.
        /// </summary>
        /// <param name="getUrl"> The url.</param>
        /// <param name="values"> The get values.</param>
        /// <param name="cookies"> The cookies.</param>
        /// <param name="state"> The http state.</param>
        private void StartGetRequest(GetForm httpCommand, string getUrl, ArrayList values, CookieCollection cookies, HttpProperties settings, HttpState state)
        {
            try
            {
                httpCommand.StartAsyncHttpGet(
                    getUrl,
                    settings,
                    values,
                    cookies,
                    state,
                    false);
            }
            catch (Exception ex)
            {
                // register and show
                Utils.ExceptionHandler.RegisterException(ex);

                AbortSessionRun(ex.Message);
            }
        }
        /// <summary>
        /// Executes the session.
        /// </summary>
        public void Run()
        {
            this._isRunning = true;

            reports = new ArrayList();

            unitTestPostRequest = new PostForm();
            unitTestGetRequest = new GetForm();

            // Add proxy settings
            unitTestPostRequest.ProxySettings = this.Context.Proxy;
            unitTestGetRequest.ProxySettings = this.Context.Proxy;

            // http settings
            unitTestPostRequest.ClientSettings = this.Context.ProtocolProperties;
            unitTestGetRequest.ClientSettings = this.Context.ProtocolProperties;

            // set events for unit test requests
            unitTestPostRequest.EndHttp += new ResponseCallbackDelegate(UnitTestResult_EndHttp);
            unitTestGetRequest.EndHttp += new ResponseCallbackDelegate(UnitTestResult_EndHttp);

            HttpState state = new HttpState();

            // the test sessin request of the safe request.
            state.TestSessionRequest = this.TestSession.SessionRequests[0];
            state.SessionRequestId = 0;
            state.IsLastItem = true;

            ExecuteNextSafeRequest(state);
        }
Exemplo n.º 14
0
 static void Main()
 {
     GetForm.Start();
     GetForm.NewForm();
     Application.Run(GetForm.MyMainForm);
 }
        // TODO: Still have to check this function, if is working as intended
        public void Run()
        {
            postRequest = new PostForm();
            getRequest = new GetForm();

            postRequest.EndHttp += new ResponseCallbackDelegate(httpResponse_EndHttp);
            getRequest.EndHttp += new ResponseCallbackDelegate(httpResponse_EndHttp);

            reports = new ArrayList();
            UnitTestSession session = this.CurrentUnitTestSession;
            int availableTests = session.AvailableTests();
            bool lastItem = false;

            // get tests count
            for (int i=0;i<session.UnitTestForms.Count;i++)
            {
                UnitTestItem testItem = session.UnitTestForms.GetByIndex(i);
                HtmlFormTag form = testItem.Form;

                #region Run each test in UnitTestItem
                // run each test in Form
                foreach (DictionaryEntry de in testItem.Tests)
                {
                    Test test = (Test)de.Value;

                    // apply test to form
                    HtmlFormTag filledForm = ApplyTestToForm(test,form.CloneTag());

                    // set current test index
                    testItem.SelectedTestIndex = testItem.Tests.IndexOfValue(test);

                    // get reponse uri
                    Uri uri = (Uri)this.CurrentUnitTestSession.SessionData.ResponseHeaderCollection["Response Uri"];

                    // resolve uri
                    string url = UriResolver.ResolveUrl(uri,filledForm.Action);

                    // process special fields
                    // filledForm = parser.ProcessSpecialFields(filledForm);

                    // convert to array list
                    ArrayList al = parser.ConvertToArrayList(filledForm);

                    // set posted data
                    StringBuilder postDataBuffer = new StringBuilder();

                    postDataBuffer.Append("?");
                    for (int k=0;k<al.Count;k++)
                    {
                        postDataBuffer.Append(al[k]);
                        postDataBuffer.Append("&");
                    }

                    test.Arguments.PostData = postDataBuffer.ToString();

                    // set last item flag
                    if ( availableTests == 1)
                    {
                        lastItem = true;
                    }

                    CookieManager cookieManager = new CookieManager();
                    CookieCollection cookies = cookieManager.GetCookies(new Uri(url));

                    if ( filledForm.Method.ToLower(System.Globalization.CultureInfo.InvariantCulture) == "get" )
                    {
                        getRequest.StartAsyncHttpGet(
                            url,
                            this.ProtocolProperties,
                            al,
                            cookies,
                            testItem.Clone(),
                            lastItem);

                    } else {
                        postRequest.StartAsyncHttpPost(
                            url,
                            this.ProtocolProperties,
                            al,
                            cookies,
                            testItem.Clone(),
                            lastItem);
                    }

                    availableTests--;
                }
                #endregion
            }
        }