private static void FillData(DataSetElement dataSet, int factoryId)
        {
            //
            // Build Data
            //
            var outputs = FactoryRepository.FindAllFactoryOutputByFactoryId(factoryId);

            var num = 0;

            foreach (var output in outputs)
            {
                var set = new ValueSetElement
                {
                    //Label = output.DatePro.Value.ToShortDateString(),
                    Value = output.Quantity ?? 0
                };

                if ((num++ % 2) == 0)
                {
                    set.Link.SetLink(FusionLinkMethod.Local, "javascript:PopUp('April');");
                }
                // 실제 Javascript 메소드를 쓰려면 "PopUp-April" 로만 쓰면 된다.
                else
                {
                    set.Link.SetLink(FusionLinkMethod.PopUp,
                                     WebTool.GetScriptPath("~/Charts/Ajax/Default.aspx?FactoryId=") + factoryId);
                    set.Link.Width  = 600;
                    set.Link.Height = 400;
                }

                dataSet.AddSet(set);
            }
        }
Ejemplo n.º 2
0
 private static void BuildAlerts(WidgetBase widget)
 {
     widget.Alerts.Add(new AlertElement
     {
         MinValue = 0,
         MaxValue = 75,
         Action   = AlertActionKind.PlaySound,
         Param    = WebTool.GetScriptPath("~/alerts/Waterloo.mp3")
     });
     widget.Alerts.Add(new AlertElement
     {
         MinValue = 0,
         MaxValue = 75,
         Action   = AlertActionKind.ShowAnnotation,
         Param    = "GrpRED"
     });
     widget.Alerts.Add(new AlertElement
     {
         MinValue = 75,
         MaxValue = 90,
         Action   = AlertActionKind.ShowAnnotation,
         Param    = "GrpYELLOW"
     });
     widget.Alerts.Add(new AlertElement
     {
         MinValue = 90,
         MaxValue = 100,
         Action   = AlertActionKind.ShowAnnotation,
         Param    = "GrpGREEN"
     });
 }
Ejemplo n.º 3
0
        public async void GetList()
        {
            await Task.Run(() =>
            {
                //007301
                //161725
                var data                    = WebTool.GetFunDetail(_RESTService, "161725").data;
                LineVm.ChartTitle           = data.name;
                UnitLineVm.ChartTitle       = data.name;
                List <List <string> > worth = data.netWorthData;
                List <WorthBase> datas      = new List <WorthBase>();
                foreach (List <string> arr in worth)
                {
                    WorthBase worthBase = new WorthBase(DateTime.Parse(arr[0]), arr[1], arr[2]);
                    datas.Add(worthBase);
                }

                datas = datas.Where(p => p.Date >= DateTime.Parse("2020-01-01")).ToList();
                foreach (var dt in datas)
                {
                    ChartDataBase line_data = new ChartDataBase("净值涨幅", dt.Date,
                                                                string.Format("{0}", dt.Rate));

                    this.LineVm.DataSource.Add(line_data);
                    LineVm.DataSource.Add(new ChartDataBase("单位净值", dt.Date,
                                                            string.Format("{0}", dt.Unit_worth)));

                    UnitLineVm.DataSource.Add(new ChartDataBase("单位净值", dt.Date,
                                                                string.Format("{0}", dt.Unit_worth)));
                }
            });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Paint Critera section of the page
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void PaintCriteraPageState()
        {
            int intOrganisationID = UserContext.UserData.OrgID;                               // organisation ID

            BusinessServices.Course objCourse = new BusinessServices.Course();                //Course Object
            DataTable dtbCourses = objCourse.GetCourseListAccessableToOrg(intOrganisationID); // List of courses accesable to the organisation

            if (dtbCourses.Rows.Count == 0)
            {
                this.plhSearchCriteria.Visible = false;
                this.lblError.Text             = ResourceManager.GetString("lblError.NoCourse");  //"No courses exist within this organisation.";
                this.lblError.CssClass         = "FeedbackMessage";
                this.lblError.Visible          = true;
                return;
            }
            cboCourse.DataSource     = dtbCourses;
            cboCourse.DataValueField = "CourseID";
            cboCourse.DataTextField  = "Name";
            cboCourse.DataBind();


            //3. setup date control
            WebTool.SetupHistoricDateControl(this.lstFromDay, this.lstFromMonth, this.lstFromYear);
            WebTool.SetupHistoricDateControl(this.lstToDay, this.lstToMonth, this.lstToYear);
        }
Ejemplo n.º 5
0
 void updateFileList(object path)
 {
     try
     {
         Path_Lab.Text = "当前路径:" + path.ToString().Replace("apps", "我的应用数据");
         var jobj = JObject.Parse(WebTool.GetHtml($"https://pcs.baidu.com/rest/2.0/pcs/file?method=list&access_token={Program.config.Access_Token}&path=" + Uri.EscapeDataString($"{path.ToString()}")));
         FilelistView.BeginUpdate();
         FilelistView.Items.Clear();
         Fileinfo.Clear();
         foreach (JObject job in jobj["list"])
         {
             DiskFileInfo fileinfo = JsonConvert.DeserializeObject <DiskFileInfo>(job.ToString());
             FilelistView.Items.Add(fileinfo.getName());
             this.Fileinfo.Add(fileinfo.getName(), fileinfo);
             if (fileinfo.isdir == 1)
             {
                 setEndItemImageKey("Dir.png");
             }
             else
             {
                 setEndItemImageKey(getIconImage(fileinfo.getSuffix()));
             }
         }
         FilelistView.EndUpdate();
     }
     catch (Exception ex)
     {
         MessageBox.Show("更新文件列表时遇到意外的错误: " + ex.ToString());
     }
     Info_Lab.Text = "等待中...";
 }
Ejemplo n.º 6
0
 private void Main_Load(object sender, EventArgs e)
 {
     System.Net.ServicePointManager.DefaultConnectionLimit = 999999;
     if (!Directory.Exists(Program.config.TempPath))
     {
         Directory.CreateDirectory(Program.config.TempPath);
     }
     LoadConfig();
     if (Program.config.WebDownload)
     {
         new WebDownload().Listen();
     }
     new Thread(Upgraded).Start();
     if (Program.config.Access_Token == "null" || Program.config.Access_Token == string.Empty)
     {
         return;
     }
     try
     {
         SpaceInfo info = JsonConvert.DeserializeObject <SpaceInfo>(WebTool.GetHtml("https://pcs.baidu.com/rest/2.0/pcs/quota?method=info&access_token=" + Program.config.Access_Token));
         // Used_Lab.Text = string.Format("网盘已使用: {0} / {1} (GB)", (float)info.used / 1024 / 1024 / 1024, (float)info.quota / 1024 / 1024 / 1024);
         Text = string.Format("已登录账户 [{0}],已使用容量 {1} / {2} (GB)", DiskAPI.GetName(Program.config.Access_Token), (float)info.used / 1024 / 1024 / 1024, (float)info.quota / 1024 / 1024 / 1024);
     }
     catch (Exception ex)
     {
         LogTool.WriteLogError(typeof(Main), "更新容量信息时出现错误", ex);
         MessageBox.Show("更新容量信息时出现错误,请尝试重新登录");
         return;
     }
     DownloadListView.View = View.Details;
     new Thread(updateFileList).Start(HomePath + Path);
 }
Ejemplo n.º 7
0
        static void TestT()
        {
            var source = WebTool.GetHtmlAsyncUtf8("http://www.mobile01.com/topicdetail.php?f=568&t=3299999");

            string aid    = null;
            string aowner = null;
            string forum  = null;

            TmpUser = new Dictionary <string, string>();

            source = WebTool.GetContent("<div class=\"forum-content\">", "<div class=\"sidebar\">", source);

            //Get Title
            var title = WebTool.GetContent("<h2 class=\"topic\">", "</h2>", source);
            //Get Page
            var page = WebTool.GetContent("<p class=\"numbers\">", "</p>", source);

            //process post -begin-
            source = WebTool.GetContent("<div class=\"single-post\">", "<div class=\"pagination\">", source);
            var ar = source.Split(new[] { "<div class=\"single-post\">" }, StringSplitOptions.RemoveEmptyEntries);

            //Get all
            foreach (var s in ar)
            {
                ProcessPost(s, ref aid, ref aowner, forum, title);
            }
        }
Ejemplo n.º 8
0
        public void CanRemoveHtml(string html)
        {
            var plainText = WebTool.RemoveHtml(html);

            Assert.AreNotEqual(html, plainText);
            Console.WriteLine("{0}=>{1}", html, plainText);
        }
Ejemplo n.º 9
0
            public override async Task <LaGouResponseDataCollection> CollectAsync(LaGouSearchParam searchParam)
            {
                string encodedCityName = WebTool.UrlEncodeByW3C(searchParam.CityName);
                string encodedKeyword  = WebTool.UrlEncodeByW3C(searchParam.Keyword);
                var    jobListUri      = PcWebApiProvider.GetJobListUri(encodedCityName, encodedKeyword, searchParam.SearchType);
                LaGouResponseDataCollection dataCollection = new LaGouResponseDataCollection();

                using var browser = await PuppeteerConsole.LauncherBrowser(false);

                using var page = await browser.NewPageAsync();

                page.Response += OnResponsed;
                await page.GoToAsync(jobListUri.AbsoluteUri).ConfigureAwait(false);                //Get the first page directly.

                for (int i = 0; i < searchParam.MaxPage - 1; i++)
                {
                    await Task.Delay(RandomTool.NextInt(2000, 4000));

                    await page.HoverAsync(NextPageElementSelector);

                    await Task.Delay(RandomTool.NextInt(3000, 5000));

                    await page.ClickAsync(NextPageElementSelector);
                }
                return(dataCollection);

                async void OnResponsed(object sender, ResponseCreatedEventArgs args)
                {
                    var rsp = args.Response;

                    if (!rsp.Url.StartsWith(PcWebApiProvider.PositionAjaxUrlPrefix))
                    {
                        return;
                    }
                    if (!rsp.Ok)
                    {
                        return;
                    }
                    string rspText = null;

                    try
                    {
                        rspText = await rsp.TextAsync();
                    }
                    catch (Exception ex)
                    {
                        ShowLogException(ex);
                        return;
                    }
                    var data = PcWebApiProvider.CreateResponseData(rspText, out string _);

                    if (data is null)
                    {
                        return;
                    }
                    dataCollection.AddResponseData(data);
                    dataCollection.FillPositions(searchParam.Keyword);
                    dataCollection.FillCompanies(searchParam.CityName);
                }
            }
Ejemplo n.º 10
0
 /// <summary>
 /// 检查更新
 /// </summary>
 void Upgraded()
 {
     try
     {
         JObject job = JObject.Parse(WebTool.GetHtml("http://www.mrs4s.top/api/update.json"));
         if ((int)job["Build"] > 2)
         {
             DialogResult dr = MessageBox.Show((string)job["Message"] + "\r\n\r\n是否更新?", "发现更新", MessageBoxButtons.OKCancel);
             if (dr == DialogResult.OK)
             {
                 try
                 {
                     System.Diagnostics.Process.Start((string)job["Yes_Button"]);
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("调用浏览器失败! " + ex.Message);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 11
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (Program.config.Access_Token == "null" || Program.config.Access_Token == string.Empty)
     {
         MessageBox.Show("你还未登录呢");
         return;
     }
     if (Info_Lab.Text == "正在刷新")
     {
         return;
     }
     Info_Lab.Text = "正在刷新";
     try
     {
         SpaceInfo info = JsonConvert.DeserializeObject <SpaceInfo>(WebTool.GetHtml("https://pcs.baidu.com/rest/2.0/pcs/quota?method=info&access_token=" + Program.config.Access_Token));
         Used_Lab.Text = string.Format("网盘已使用: {0} / {1} (GB)", (float)info.used / 1024 / 1024 / 1024, (float)info.quota / 1024 / 1024 / 1024);
         Text          = string.Format("已登录账户 [{0}],已使用容量 {1} / {2} (GB)", DiskAPI.GetName(Program.config.Access_Token), (float)info.used / 1024 / 1024 / 1024, (float)info.quota / 1024 / 1024 / 1024);
     }
     catch (Exception ex)
     {
         LogTool.WriteLogError(typeof(Main), "更新容量信息时出现错误", ex);
         MessageBox.Show("更新容量信息时出现错误,请尝试重新登录");
         return;
     }
     new Thread(updateFileList).Start(HomePath + Path);
 }
Ejemplo n.º 12
0
        public static void DoWebRequest_Returns_Result()
        {
            var result = WebTool.DoWebRequest("http://www.google.com", "Token");

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Length, Is.GreaterThan(0));
        }
Ejemplo n.º 13
0
 void AddDownloadButton()
 {
     if (checkBox1.Checked)
     {
         Program.config.DownloadPath = textBox1.Text;
         Program.config.save();
     }
     if (!Directory.Exists(textBox1.Text))
     {
         MessageBox.Show("下载文件夹不存在!");
         return;
     }
     if (info.isdir == 1)
     {
         Directory.CreateDirectory(textBox1.Text + "\\" + info.getName());
         JObject jobj = JObject.Parse(WebTool.GetHtml(string.Format("https://pcs.baidu.com/rest/2.0/pcs/file?method=list&access_token={0}&path={1}", Program.config.Access_Token, info.path)));
         foreach (JObject job in jobj["list"])
         {
             BaiduPanDownload.Data.FileInfo fileinfo = JsonConvert.DeserializeObject <BaiduPanDownload.Data.FileInfo>(job.ToString());
             main.AddDownloadFile(fileinfo, textBox1.Text + "\\" + info.getName(), fileinfo.getName());
         }
         this.Close();
         return;
     }
     main.AddDownloadFile(info, textBox1.Text, info.getName());
     this.Close();
 }
    private void drawImportExportGUI()
    {
        GUIStyle btnStyle = new GUIStyle(GUI.skin.GetStyle("Button"))
        {
            fixedWidth = 100,
            alignment  = TextAnchor.MiddleCenter
        };

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Import from: ", EditorStyles.label);
        drawBtn("Google Sheet", btnStyle, ImportToggle.GoogleSheet, () =>
        {
            // download excel from google sheet

            Action <string> callback = (string path) =>
            {
                // parse excel file
                ImportFromExcel(path);
            };

            WebTool.DownloadXLSX(GameConstant.GoogleSheetId, callback, fileName);
        });
        drawBtn("Excel", btnStyle, ImportToggle.Excel, () => {
            string path = EditorUtility.OpenFilePanel("Open Excel File", GameConstant.ExcelSourceFolder, "xlsx");
            if (path.Length != 0)
            {
                ImportFromExcel(path);
            }
        });
        drawBtn("Json", btnStyle, ImportToggle.Json, () =>
        {
            string path = EditorUtility.OpenFilePanel("Open Json File", GameConstant.JsonSourceFolder, "json");
            if (path.Length != 0)
            {
                ImportFromJson(path);
            }
        });
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Export to: ", EditorStyles.label);
        drawBtn("Google Sheet", btnStyle, ExportToggle.GoogleSheet);
        drawBtn("Excel", btnStyle, ExportToggle.Excel, () => {
            var path = EditorUtility.SaveFilePanel("Save Excel File", GameConstant.ExcelSourceFolder, string.Format("{0}.{1}", fileName, "xlsx"), "xlsx");
            if (path.Length != 0)
            {
                ExportToExcel(path);
            }
        });
        drawBtn("Json", btnStyle, ExportToggle.Json, () =>
        {
            var path = EditorUtility.SaveFilePanel("Save Json File", GameConstant.JsonSourceFolder, string.Format("{0}.{1}", fileName, "json"), "json");
            if (path.Length != 0)
            {
                ExportToJson(path);
            }
        });
        EditorGUILayout.EndHorizontal();
    }
Ejemplo n.º 15
0
        /// <summary>
        /// Paint Critera section of the page.
        /// </summary>
        private void PaintCriteraPageState()
        {
            // Get Units accessable to this user.
            BusinessServices.Unit objUnit = new BusinessServices.Unit();
            DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A');

            // Convert this to an xml string for rendering by the UnitTreeConverter.
            string strUnits = UnitTreeConvert.ConvertXml(dstUnits);

            if (strUnits == "")
            {
                // No units found.
                this.lblError.Visible          = true;
                this.lblError.Text            += "<BR>" + ResourceManager.GetString("lblError.NoUnit");     //No units exist within this organisation.";
                this.lblError.CssClass         = "FeedbackMessage";
                this.plhSearchCriteria.Visible = false;
            }
            else
            {
                // Change to the appropriate view and load the Units in
                this.trvUnitsSelector.LoadXml(strUnits);
            }


            // Get Policies accessable to this organisation
            BusinessServices.Policy objPolicy = new BusinessServices.Policy();
            Organisation            objOrg    = new Organisation();

            //DataTable dtbPolicies = objPolicy. //  objCourse.GetCourseListAccessableToOrg(UserContext.UserData.OrgID);
            DataTable dtbPolicies = objOrg.GetOrganisationPolicies(UserContext.UserData.OrgID);

            if (dtbPolicies.Rows.Count > 0)
            {
                lstPolicy.DataSource     = dtbPolicies;
                lstPolicy.DataTextField  = "PolicyName";
                lstPolicy.DataValueField = "PolicyID";
                lstPolicy.DataBind();
            }
            else
            {
                this.lblError.Visible          = true;
                this.lblError.Text            += "<BR>" + ResourceManager.GetString("lblError.NoPolicy");     //"No courses exist within this organisation.";
                this.lblError.CssClass         = "WarningMessage";
                this.plhSearchCriteria.Visible = false;
            }
            // If there is at least one course then select it.
            if (lstPolicy.Items.Count > 0)
            {
                lstPolicy.SelectedIndex = 0;
            }

            // Initialise the date list boxes.
            WebTool.SetupHistoricDateControl(this.lstEffectiveDay, this.lstEffectiveMonth, this.lstEffectiveYear);
            WebTool.SetupHistoricDateControl(this.lstEffectiveToDay, this.lstEffectiveToMonth, this.lstEffectiveToYear);

            radAcceptance.Items[0].Text = ResourceManager.GetString("radAcceptance.1");
            radAcceptance.Items[1].Text = ResourceManager.GetString("radAcceptance.2");
            radAcceptance.Items[2].Text = ResourceManager.GetString("radAcceptance.3");
        }
Ejemplo n.º 16
0
 public static void DoWebRequest_Throws_WebException(string uri)
 {
     Assert.That(
         () => WebTool.DoWebRequest(uri),
         Throws.TypeOf <WebException>()
         .With.Message
         .Contains("The remote name could not be resolved")
         );
 }
Ejemplo n.º 17
0
        /// <summary>
        /// 预下单,获取订单号
        /// </summary>
        public static string PreOrder(PayParam param)
        {
            string orderUrl = param.SeverUrl + "?" + "TYPE=PreOrder" + "&" + param.ToString();

            string data    = WebTool.getWebData(orderUrl);
            string orderId = WebTool.getNodeData(data, "Result", false).Trim();

            return(orderId);
        }
Ejemplo n.º 18
0
        // 支付结果处理逻辑
        private void PayResult(string param)
        {
            string isSuccess = WebTool.getNodeData(param, "isSuccess", false).ToLower();

            if (isSuccess.Equals("true"))
            {
                string serial = MachineInfo_Serial.RegSerial(SoftName);
                RegistryTool.RegistrySave(AuthorName + @"\" + SoftName + @"\Set", "Serial", serial);
                MessageBox.Show("恭喜,您已成功注册!(即时注册)");
            }
        }
Ejemplo n.º 19
0
 public static void DoWebRequest_Throws_ArgumentException(string uri)
 {
     Assert.That(
         () => WebTool.DoWebRequest(uri),
         Throws.TypeOf <ArgumentException>()
         .With
         .Message.Contains("url")
         .And
         .Message.Contains("Value must not be null or whitespace.")
         );
 }
        private static void FillData(SingleSeriesChart chart, int factoryId)
        {
            //
            // Build Data
            //
            var outputs = FactoryRepository.FindAllFactoryOutputByFactoryId(factoryId);

            var num = 0;

            foreach (var output in outputs)
            {
                var set = new ValueSetElement
                {
                    Label = output.DatePro.Value.ToShortDateString(),
                    Value = output.Quantity ?? 0
                };

                switch (num % 4)
                {
                case 0:
                    set.Link.SetLink(FusionLinkMethod.Local, "javascript:PopUp('April')");
                    break;

                case 1:
                    set.Link.SetLink(FusionLinkMethod.PopUp,
                                     WebTool.GetScriptPath("~/Charts/Ajax/Default.aspx?FactoryId=") + factoryId);
                    break;

                case 2:
                    set.Link.SetFameLink(WebTool.GetScriptPath("~/Charts/Ajax/Default.aspx?FactoryId=") + factoryId, "_blank");
                    break;

                case 3:
                    set.Link.SetJavascriptLink("PopUp", "April");
                    break;

                default:
                    set.Link.SetLink(FusionLinkMethod.Local, "http://www.realweb21.com");
                    break;
                }

                num++;
                //if ((num++ % 2) == 0)
                //    set.Link.SetLink(FusionLinkMethod.Local, "javascript:PopUp('April');"); // 실제 Javascript 메소드를 쓰려면 "PopUp-April" 로만 쓰면 된다.
                //else
                //{
                //    set.Link.SetLink(FusionLinkMethod.PopUp, WebTool.GetScriptPath("~/Charts/Ajax/Default.aspx?FactoryId=") + factoryId.ToString());
                //    set.Link.Width = 600;
                //    set.Link.Height = 400;
                //}

                chart.SetElements.Add(set);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Header에 ContentType, Cache 설정을 수행합니다.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="filename"></param>
        private static void SetRepsonseHeaders(HttpContext context, string filename)
        {
            context.Response.Clear();
            context.Response.ContentType = WebTool.GetMime(filename);

            context.Response.Cache.SetExpires(DateTime.Now.ToUniversalTime().AddYears(1));
            context.Response.Cache.SetMaxAge(new TimeSpan(365, 0, 0, 0));

            // NOTE : HTTPS 에서 동작하기 위해
            context.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Paint Critera section of the page
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void PaintCriteraPageState()
        {
            //1. Paint the unit selector
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();                                         // Unit Object
            DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Data set to contain unit details

            if (dstUnits.Tables[0].Rows.Count == 0)
            {
                this.plhSearchCriteria.Visible = false;
                this.lblError.Text             = ResourceManager.GetString("lblError.NoUnit");  //"No units exist within this organisation.";
                this.lblError.Visible          = true;

                return;
            }
            string strUnits = UnitTreeConvert.ConvertXml(dstUnits);             // comma seperated list of units

            this.trvUnitsSelector.LoadXml(strUnits);

            //2. Paint the course list details
            int intOrganisationID = UserContext.UserData.OrgID;                               // organisation ID

            BusinessServices.Course objCourse = new BusinessServices.Course();                //Course Object
            // Get Courses accessable to this organisation
            DataTable dtbCourses = objCourse.GetCourseListAccessableToOrg(intOrganisationID); // List of courses accesable to the organisation

            if (dtbCourses.Rows.Count > 0)
            {
                lstCourses.DataSource     = dtbCourses;
                lstCourses.DataTextField  = "Name";
                lstCourses.DataValueField = "CourseID";
                lstCourses.DataBind();
            }
            else
            {
                this.plhSearchCriteria.Visible = false;
                this.lblError.Text             = ResourceManager.GetString("lblError.NoCourse");  //"No courses exist within this organisation.";
                this.lblError.CssClass         = "FeedbackMessage";
                this.lblError.Visible          = true;
                return;
            }
            // If there is at least one course then select it.
            if (lstCourses.Items.Count > 0)
            {
                lstCourses.SelectedIndex = 0;
            }

            //3. setup date control
            WebTool.SetupHistoricDateControl(this.lstEffectiveDay, this.lstEffectiveMonth, this.lstEffectiveYear);
            WebTool.SetupHistoricDateControl(this.lstEffectiveToDay, this.lstEffectiveToMonth, this.lstEffectiveToYear);

            //4. show custom classification dropdown if required
            DisplayClassifications();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Fusion Chart 에 대한 HTML 을 Response에 씁니다.
        /// </summary>
        /// <param name="output">Rendering 대상 HtmlTextWriter</param>
        protected override void RenderContents(HtmlTextWriter output)
        {
            if (IsDebugEnabled)
            {
                log.Debug(@"FusionChart Control을 HTML로 Rending을 시작합니다... ChartId={0}, FileName={1}", ChartId, FileName);
            }

            output.WriteLine(FusionCharts_Javascript);
            output.WriteLine(FusionChartsExportComponent_Javascript);

            var filename = FileName;

            if (filename.StartsWith("~") || filename.Contains("/") || filename.Contains(@"\"))
            {
                filename = WebTool.GetScriptPath(filename);
            }
            else
            {
                filename = HandlerSettings.ResourceFileHandler + "?File=" + filename;
            }

            if (IsDebugEnabled)
            {
                log.Debug(@"Render FusionChart WebControl. " +
                          @"Chart Filename={0}, DataUrl={1}, DataXml={2}, ChartId={3}, Width={4}, Height={5}, DebugMode={6}, RegisterWithJS={7}, Transparent={8}",
                          filename, DataUrl, DataXml, ChartId, Width, Height, DebugMode, RegisterWithJS, Transparent);
            }

            var html = ChartUtil.RenderChartHtml(filename,
                                                 DataUrl,
                                                 DataXml,
                                                 ChartId,
                                                 Width.ToString(),
                                                 Height.ToString(),
                                                 DebugMode,
                                                 RegisterWithJS,
                                                 Transparent);

            if (IsDebugEnabled)
            {
                log.Debug("Rendering Html= " + html);
            }

            output.WriteLine();
            output.WriteLine(html);
            output.WriteLine();

            if (IsDebugEnabled)
            {
                log.Debug(@"FusionChart Control을 HTML로 Rending을 완료했습니다!!! ChartId={0}, FileName={1}", ChartId, FileName);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Chart를 HTML Code로 Rendering을 수행합니다.
        /// 이 함수를 수행하려면, ASP.NET Page에 FunsionChart JavaScript class를 포함하고 있어야 합니다.
        /// </summary>
        /// <param name="chartSwf">Chart에 해당하는 SWF 파일명 (전체경로)</param>
        /// <param name="dataUrl">Data 제공을 URL을 통해서 할 경우, dataXml로 할 경우에는 빈 문자열을 지정하면 된다.</param>
        /// <param name="dataXml">Data 제공을 XML로 제공할 경우, Data정보를 나타낸다. dataUrl 방식이라면, 빈문자열을 지정</param>
        /// <param name="chartId">HTML Code 상에서 Chart의 고유 ID</param>
        /// <param name="width">Chart 폭 (pixel 단위 또는 %)</param>
        /// <param name="height">Chart 높이 (pixel 단위 또는 %)</param>
        /// <param name="debugMode">디버그 모드</param>
        /// <param name="registerWithJS">JavaScript에 Chart를 자체적으로 등록할 것인가 여부</param>
        /// <param name="transparent">Chart 투명화 여부</param>
        /// <returns>Chart를 보이기 위한 JavaScript + HTML Code</returns>
        private static string RenderChartHtmlInternal(string chartSwf, string dataUrl, string dataXml,
                                                      string chartId, string width, string height,
                                                      bool debugMode, bool registerWithJS, bool transparent)
        {
            var chartSwfPath = WebTool.GetScriptPath(chartSwf);

            if (IsDebugEnabled)
            {
                log.Debug("Render Chart Starting...");
                log.Debug("SWF={0}, dataUrl={1}, dataXml={2}", chartSwfPath, dataUrl, dataXml.EllipsisChar(100));
                log.Debug("charId={0}, width={1}, height={2}, debugMode={3}, registerWithJS={4}, transparent={5}",
                          chartId, width, height, debugMode, registerWithJS, transparent);
            }

            var flashVariables =
                string.Format("&chartWidth={0}&chartHeight={1}&debugMode={2}&registerWithJS={3}&DOMId={4}",
                              width, height, debugMode.GetHashCode(), registerWithJS.GetHashCode(), chartId);

            flashVariables += dataUrl.IsWhiteSpace()
                                  ? "&dataXml=" + dataXml
                                  : "&dataUrl=" + WebTool.GetScriptPath(dataUrl).UrlEncode();

            var builder = new StringBuilder();

            builder.AppendFormat("<!-- START Code Block for Chart {0} -->", chartId).AppendLine();
            builder.AppendFormat("<div id='{0}Div'>", chartId).AppendLine();
            builder.AppendFormat("<object classid=\"clsid:{0}\" ", CHART_CLASS_ID);
            builder.AppendFormat("codebase=\"{0}\" ", CHART_CODE_BASE);
            builder.AppendFormat(" width=\"{0}\" height=\"{1}\" name=\"{2}\" id=\"{2}\" >", width, height, chartId).AppendLine();

            builder.AddParamLine("allowScriptAccess", "always");
            builder.AddParamLine("movie", chartSwfPath);
            builder.AddParamLine("FlashVars", flashVariables);
            builder.AddParamLine("quality", "high");

            var wmode = string.Empty;

            if (transparent)
            {
                builder.AppendFormat(CHART_PARAM_FMT, "wmode", "transparent").AppendLine();
                wmode = "wmode=\"transparent\"";
            }

            builder.AppendFormat(
                "<embed src=\"{0}\" FlashVars=\"{1}\" quality=\"high\" width=\"{2}\" height=\"{3}\" name=\"{4}\" id=\"{4}\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" {5} />",
                chartSwfPath, flashVariables, width, height, chartId, wmode);
            builder.AppendLine("</object>");
            builder.AppendLine("</div>");
            builder.AppendFormat("<!-- END Code Block for Chart {0} -->", chartId).AppendLine();

            return(builder.ToString());
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 查询KEY列对应的数据信息
        /// </summary>
        /// <param name="KEY">列名称</param>
        /// <param name="machinCode">机器码</param>
        /// <param name="soft">软件名称</param>
        /// <returns></returns>
        public string GetValue(string KEY, string machinCode, string soft)
        {
            string Url  = "http://" + QrPayServerAddress + "/pages/onlineserial.aspx?TYPE=GetValue&KEY=" + KEY + "&machinCode=" + machinCode + "&soft=" + soft;
            string data = WebTool.getWebData(Url).Trim();

            if (!data.Equals(""))
            {
                data = Locker.Decrypt(data, machinCode + soft);
                data = WebTool.getNodeData(data, KEY, false);
            }

            return(data);
        }
Ejemplo n.º 26
0
        public void Copy(string Path)
        {
            var info = new CopyInfo();

            foreach (DiskFileInfo copy in CopyList)
            {
                info.Add(copy.path, Path + "/" + copy.getName());
            }
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("param", JsonConvert.SerializeObject(info));
            WebTool.CreatePostHttpResponse($"https://pcs.baidu.com/rest/2.0/pcs/file?method=copy&access_token={Program.config.Access_Token}", parameters, null, null, Encoding.UTF8, null);
        }
Ejemplo n.º 27
0
        private void Main_Load(object sender, EventArgs e)
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 99999;
            if (Program.config.Access_Token == "null" || Program.config.Access_Token == string.Empty)
            {
                return;
            }
            SpaceInfo info = JsonConvert.DeserializeObject <SpaceInfo>(WebTool.GetHtml("https://pcs.baidu.com/rest/2.0/pcs/quota?method=info&access_token=" + Program.config.Access_Token));

            Used_Lab.Text         = string.Format("网盘已使用: {0} / {1} (GB)", (float)info.used / 1024 / 1024 / 1024, (float)info.quota / 1024 / 1024 / 1024);
            DownloadListView.View = View.Details;
            new Thread(updateFileList).Start(HomePath + Path);
        }
Ejemplo n.º 28
0
        public void Init()
        {
            LoadOrCreateSettings();

            tools      = new ObservableCollection <Tool>();
            orgUrls    = new ObservableCollection <string>();
            localRepos = new Dictionary <string, ObservableCollection <Repo> >();

            foreach (var repoRoot in Settings.RepoRoots)
            {
                try
                {
                    Repo.AddRepos(orgUrls, localRepos, repoRoot);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
            }

            Tools.DataContext     = tools;
            Orgs.DataContext      = orgUrls;
            RepoNames.ItemsSource = null;
            Repos.ItemsSource     = null;

            //Visual Studio 2019
            VSTool.AddTools(tools, Settings.VSRoot);

            //VS Code
            VSCodeTool.AddTools(tools, Settings.VSCodeExe);

            //dotnet sdk
            DotNetSDKTool.AddTools(tools, Settings.DotnetSDKRoot, "SDK");

            //Windows Terminal
            NuGetFreeTool.AddTools(tools, Settings.WindowsTerminalExe, argument: "-p PowerShell");

            //Windows Explorer
            NuGetFreeTool.AddTools(tools, Settings.ExplorerExe);

            foreach (var toolExe in Settings.ToolExes)
            {
                NuGetFreeTool.AddTools(tools, Environment.ExpandEnvironmentVariables(toolExe));
            }

            foreach (var webUrl in Settings.WebUrls)
            {
                Uri uri = new Uri(webUrl);
                WebTool.AddTools(tools, webUrl, uri.Host, Settings.BrowserExe);
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 获取指定网址中的配置信息
        /// </summary>
        /// <param name="configUrl">配置信息对应网址</param>
        /// <param name="key">配置节点名</param>
        public static String GetWebConfig(string key = "", string configUrl = "")
        {
            //if (configUrl.Equals("")) configUrl = "https://git.oschina.net/joymeng/" + NAMESPACE + "/raw/master/config.txt";
            if (configUrl.Equals(""))
            {
                configUrl = "https://raw.githubusercontent.com/joymeng/" + NAMESPACE + "/master/config.txt";
            }
            if (key.Equals(""))
            {
                return("");
            }

            return(WebTool.getWebData(configUrl, key));
        }
Ejemplo n.º 30
0
        public void SetActualTool(WebTool tool)
        {
            StringBuilder sb = new StringBuilder("");

            int tl = (int)tool;

            sb.Append(@"<script language='javascript'>");
            sb.Append(@"WriteTool('" + ClientID + "'," + tl.ToString() + ");");
            sb.Append(@"</script>");

            ClientScriptManager cm = this.Page.ClientScript;

            cm.RegisterStartupScript(this.GetType(), "ajax", sb.ToString(), false);
        }
Ejemplo n.º 31
0
        public void SetActualTool(WebTool tool)
        {
            StringBuilder sb = new StringBuilder("");

            int tl = (int)tool;

            sb.Append(@"<script language='javascript'>");
            sb.Append(@"WriteTool('" + ClientID + "'," + tl.ToString() + ");");
            sb.Append(@"</script>");

            ClientScriptManager cm = this.Page.ClientScript;

            cm.RegisterStartupScript(this.GetType(), "ajax", sb.ToString(), false);

        }