コード例 #1
0
ファイル: S365FilePickerForm.cs プロジェクト: Greg66/dwsim6
        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);
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #5
0
        public LoginForm()
        {
            _authService = new AuthService();
            _authService.OnNavigateToLoginPage += (s, e) => RedirectToLoginPage();

            var initalUrl  = GetLoginPageUrl();
            var useLocalUI = false;

            if (!IsProVersion())
            {
                initalUrl  = "login/intro";
                useLocalUI = true;
            }

            _webUIForm = new WebUIForm(initalUrl, "Login with Simulate 365 account", useLocalUI)
            {
                Width  = 500,
                Height = 600
            };


            _webUIForm.SubscribeToNavigationStarting(WebView_NavigationStarting);
            _webUIForm.SubscribeToInitializationCompleted(Browser_CoreWebView2InitializationCompleted);
        }