Exemplo n.º 1
0
        public S365File ShowSaveDialog(List <string> fileFormats = null)
        {
            var navigationPath = "filepicker/save";
            var queryParams    = new Dictionary <string, string>();

            if (fileFormats != null && fileFormats.Count > 0)
            {
                queryParams.Add("extensions", string.Join("_", fileFormats));
            }
            if (!string.IsNullOrWhiteSpace(SuggestedDirectory))
            {
                queryParams.Add("directory", HttpUtility.UrlEncode(SuggestedDirectory));
            }

            if (!string.IsNullOrWhiteSpace(SuggestedFilename))
            {
                queryParams.Add("filename", HttpUtility.UrlEncode(SuggestedFilename));
            }

            var initialUrl = $"{navigationPath}";

            if (queryParams.Any())
            {
                initialUrl = initialUrl + string.Join("", queryParams.Select(x =>
                {
                    var param = $"{x.Key}={x.Value}";
                    return(queryParams.First().Key == x.Key ? $"?{param}" : $"&{param}");
                }).ToList());
            }

            string title = "Save file to Simulate 365 Dashboard";

            _webUIForm = new WebUIForm(initialUrl, title, true)
            {
                Width  = 1300,
                Height = 800
            };

            _webUIForm.SubscribeToInitializationCompleted(Browser_CoreWebView2InitializationCompleted);

            _webUIForm.ShowDialog();

            return(_filePickerService.SelectedSaveFile != null ?
                   new S365File(null)
            {
                DriveId = _filePickerService.SelectedSaveFile.FlowsheetsDriveId,
                FileId = null,
                Filename = _filePickerService.SelectedSaveFile.Filename,
                ParentDriveId = _filePickerService.SelectedSaveFile.ParentDriveId,
                FullPath = _filePickerService.SelectedSaveFile.SimulatePath
            } : null);
        }
Exemplo n.º 2
0
        public static void WebUIDebug(string Tvalue, string Target)
        {
            WebUIForm Form = new WebUIForm();

            Form.Text += ": " + "调试模式";
            Form.TvalueTxtBox.Text     = Tvalue;
            Form.TargetTxtBox.Text     = Target;
            Form.RetrunElement.Enabled = false;
            Form.GenerateXpath_Click(Form, new EventArgs());
            Form.TopMost = true;
            Form.Focus();
            Form.ShowDialog();
        }
Exemplo n.º 3
0
        public static void WclForm_Xpath(string Xpath)
        {
            WebUIForm Form = new WebUIForm();

            Form.Text += ": " + "Xpath找不到对应元素";
            var Collection = Xpath.Split('|');

            foreach (string item in Collection)
            {
                Form.XpathDateView.Rows.Add(item.Trim());
            }
            Form.TopMost = true;
            Form.Focus();
            Form.ShowDialog();
        }
Exemplo n.º 4
0
        public static void WclForm_Element(IWebElement element, string Title)
        {
            WebUIForm Form = new WebUIForm();

            WebUIForm.elements.Add(element);
            JS.WclForm_SetBorder(SXDXWeb.driver, element);
            Form.Text += ": " + Title;
            string TagName = element.TagName;
            string Text    = element.Text;
            string Name    = element.GetAttribute("Name");
            string Value   = element.GetAttribute("Value");
            string width   = element.Size.Width.ToString();
            string height  = element.Size.Height.ToString();

            Form.ResultDateView.Rows.Add(TagName, Text, Name, Value, width, height);
            Form.TopMost = true;
            Form.Focus();
            Form.ShowDialog();
        }
Exemplo n.º 5
0
 public void ShowDialog()
 {
     _webUIForm.ShowDialog();
 }