public override void onCreate() { base.onCreate(); SA mAccessory = new SA(); try { mAccessory.initialize(this); } catch (SsdkUnsupportedException e) { // try to handle SsdkUnsupportedException if (processUnsupportedException(e) == true) { return; } } catch (Exception e1) { Console.WriteLine(e1.ToString()); Console.Write(e1.StackTrace); /* * Your application can not use Samsung Accessory SDK. Your application should work smoothly * without using this SDK, or you may want to notify user and close your application gracefully * (release resources, stop Service threads, close UI thread, etc.) */ stopSelf(); } }
private void ComputeButton_Click(object sender, EventArgs e) { Address homeAddress = data.HomeAddress(); List <Address> customersList = data.AllCustomers(); List <ListViewItem> selected = CustomersListCheck.CheckedItems.OfType <ListViewItem>().ToList(); List <string> selectedNames = new List <string>(from choice in selected select choice.Text); List <Address> allNames = new List <Address>() { homeAddress }; allNames.AddRange(customersList.Where(x => selectedNames.Contains(x.name))); // TODO: parametrize var result = SA.Start_SA( 100000000, 0.00001, 0.9999, data, selectedNames, new Distance(data.getSpecifiedDurations(selectedNames)), new Distance(data.getSpecifiedDistances(selectedNames)), new SA_Result() ); var form = new OptimalizationResultForm(result.optimal_road, allNames); form.Show(); }
public void Update() { if (Input.GetKeyDown(KeyCode.R)) { Success.SetActive(false); Banner.SetActive(true); A.SetActive(true); B.SetActive(true); C.SetActive(true); D.SetActive(true); SA.SetActive(true); SB.SetActive(true); SC.SetActive(true); SD.SetActive(true); light.color = new Color32(180, 255, 239, 255); SA.transform.eulerAngles = new Vector3(0, 0, 7); SB.transform.eulerAngles = new Vector3(0, 0, 7); SC.transform.eulerAngles = new Vector3(0, 0, 7); SD.transform.eulerAngles = new Vector3(0, 0, 7); AS.switchCondition = false; BS.switchCondition = false; CS.switchCondition = false; DS.switchCondition = false; } }
private bool CheckSignature(ISource source, string cellFileName, string cellPath, string signaturePath) { S63SignatureFile sig = new S63SignatureFile(source.OpenRead(signaturePath)); var certSig = sig.DataServerCertSignedBySA; var publicKeyFromFile = sig.PublicKeyOfDSCert();// the whole second half the of the signature file -- Encoding.ASCII.GetBytes(LineRange(8, 8)); var pkHash = SHA1.ComputeHash(publicKeyFromFile); if (!SA.VerifySignature(pkHash, certSig)) { WriteVerbose($"Cell certificate not signed {cellFileName}"); return(false); } var cellHash = SHA1.ComputeHash(source.OpenRead(cellPath)); using (var dsaCell = new DSACryptoServiceProvider()) { dsaCell.ImportParameters(new DSAParameters() { P = sig.BigP, Q = sig.BigQ, G = sig.BigG, Y = sig.BigY, }); return(dsaCell.VerifySignature(cellHash, sig.CellSignature)); } }
public static SimulatedAnnealing CreateSA(Simulation simulation, int durationMiliseconds, SimulatedAnnealingBase.DebugLevel debugLevel) { double initialTemperature = simulation.Evaluator.MaxValidScore * InitialTemperatureScaling; double cr = SA.CoolingRate(durationMiliseconds, SA.NrIterations, SA.CR); return(new SimulatedAnnealing(simulation, durationMiliseconds, initialTemperature, cr, SA.NrIterations, debugLevel)); }
public async Task <IEnumerable <TeacherAssignmentModel> > getTeacherForAssignment() { var query = await(from teacher in PIDBContext.Users join userRole in PIDBContext.UserRoles on teacher.Id equals userRole.UserId join role in PIDBContext.Roles on userRole.RoleId equals role.Id join assignment in PIDBContext.Assignments on teacher.Id equals assignment.UserId into TA from subassignment in TA.DefaultIfEmpty() join area in PIDBContext.Areas on subassignment.AreaId equals area.Id into SA from subarea in SA.DefaultIfEmpty() where role.NormalizedName == "PROFESOR" && teacher.Status == true && (subassignment == null ? true :(subassignment.Status == true ? true : false)) select new TeacherAssignmentModel { Id = teacher.Id, Name = teacher.Name, LastName = teacher.LastName, RoleName = role.Name, City = teacher.City, Degree = teacher.Degree, Email = teacher.Email, AreaId = subassignment.AreaId, AreaName = subarea.Name ?? "Sin Area", AssignmentId = subassignment.Id.GetValueOrDefault() }).AsNoTracking().ToArrayAsync(); return(query); }
public SABlock GetNextBlock(SABlock block, bool forward) { SA parentSA = block.ParentSA; int indexBlock = parentSA.Blocks.IndexOf(block); if (indexBlock != -1) { int nextIndex = indexBlock + (forward ? 1 : -1); if (0 <= nextIndex && nextIndex < parentSA.Blocks.Count) { return(parentSA.Blocks[nextIndex]); } } if (forward) { return(parentSA.GetFirstBlock()); } else { return(parentSA.GetLastBlock()); } }
private void CreateTreeBySA(SA sA) { tVSA.BeginUpdate(); tVSA.Nodes.Clear(); TreeNode nodeSA = new TreeNode(); nodeSA.Text = sA.Name; nodeSA.Tag = sA; nodeSA.Expand(); nodeSA.ImageKey = nodeSA.SelectedImageKey = "SA"; nodeSA.ContextMenuStrip = contMSTreeNode; foreach (SABlock block in sA.Blocks) { TreeNode nodeBlock = new TreeNode(); nodeBlock.Text = block.ToString(); nodeBlock.Tag = block; nodeBlock.ImageKey = nodeBlock.SelectedImageKey = "SABlock"; nodeBlock.ContextMenuStrip = contMSTreeNode; nodeSA.Nodes.Add(nodeBlock); FillBlockContent(nodeBlock, block); } tVSA.Nodes.Add(nodeSA); tVSA.EndUpdate(); }
public override void Single() { if (GeneTestSetup.Instance.IsSimulated) { GeneSimulatedData(); } else { ///set sa SA.ResetInterface(); SA.StartFreq = StartFreq; SA.StopFreq = StopFreq; SA.DetType = SpecAnalyzerDetTypeEnum.POS; SA.RBW = RBW; SA.VBW = RBW; SA.RefLevel = RefLevel; SA.SweepPoints = SweepPoints; SA.InitContEnable = false; if (!SweepTimeAutoEnable) { SA.SweepTime = SweepTime; } (SA as InstruDriver).Wait(1000); sweepTime = (int)SA.SweepTime * 1000; ///single SA.Init(); (SA as InstruDriver).Wait(sweepTime * 2 + 1000); double spur = GetSpur(); (ItemList[0] as PointTestItem).Y = spur; (ItemList[0] as PointTestItem).X = SignalFreq; } }
public override void OnCreate() { Android.Util.Log.Debug(TAG, "ProviderService.OnCreate"); base.OnCreate(); var mAccessory = new SA(); try { mAccessory.Initialize(this); } catch (SsdkUnsupportedException) { // try to handle SsdkUnsupportedException } catch (Exception ex) { ex.ToString(); /* * Your application can not use Samsung Accessory SDK. Your application should work smoothly * without using this SDK, or you may want to notify user and close your application gracefully * (release resources, stop Service threads, close UI thread, etc.) */ StopSelf(); } _isServiceStarted = true; //_powerManager = (PowerManager)GetSystemService(PowerService); //_wakeLock = _powerManager.NewWakeLock(WakeLockFlags.Partial, _wakeLockTag); }
protected void Page_Load(object sender, EventArgs e) { SA mSa = new SA(); int Sum = Convert.ToInt32(mSa.NotActSum()); NotActNum.Text = "未激活账号数:" + Sum.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SA mSa = new SA(); SAController mSaController = new SAController(); StoreUser mStoreUser = new StoreUser(); //传进相对应的UserName if (Session["StoreUserName"] != null) { mStoreUser.UserName = Session["StoreUserName"].ToString(); //得到StoreUser的详细信息 string[] mStoreUserInfo = mSaController.GetStoreUserInfo(mSa, mStoreUser.UserName); this.tbxUserName.Text = mStoreUserInfo[0]; this.tbxUserID.Text = mStoreUserInfo[2]; this.lbStoreType.Text = mStoreUserInfo[3]; this.tbxTrueName.Text = mStoreUserInfo[4]; this.tbxCreditCard.Text = mStoreUserInfo[5]; this.tbxAge.Text = mStoreUserInfo[6]; this.tbxSex.Text = mStoreUserInfo[7]; this.tbxEmail.Text = mStoreUserInfo[8]; this.tbxPhone.Text = mStoreUserInfo[9]; this.tbxRegisterTime.Text = mStoreUserInfo[10]; this.tbxQQ.Text = mStoreUserInfo[11]; this.tbxTotalConsum.Text = mStoreUserInfo[12]; } } }
private double GetSpur() { double[] traceData = SA.GetTraceData(); double Peak = traceData.Max(); if (IsSignalON) { double deltaF = (StopFreq - StartFreq) / SA.SweepPoints; int startn = (int)Math.Ceiling(StartFreq / SignalFreq); if (startn == 0) { startn = 1; } int stopn = (int)Math.Floor(StopFreq / SignalFreq); int idSpan = (int)Math.Round(SignalIdentifySpan / deltaF / 2); for (int i = startn; i <= stopn; i++) { int temp = (int)Math.Round((i * SignalFreq - StartFreq) / deltaF); for (int j = temp - idSpan; j < temp + idSpan; j++) { if (j > -1 && j < SA.SweepPoints) { traceData[j] = -200; } } } double NextPeak = traceData.Max(); return(NextPeak - Peak); } else { return(Peak); } }
public void Main() { var sa = new SA { PA = 10, PB = 20 }; Console.WriteLine(sa.GetPA()); // 10 が出力される Console.WriteLine(sa.GetPB()); // 22 が出力される Console.WriteLine(sa.PB); // 22 が出力される }
private bool XmlDataServersSignedBySA(XmlDataServer ds) { byte[] sig = ds.CertR.Concat(ds.CertS).ToArray(); byte[] pubkey = ds.PublicKeyOfDSCert; byte[] pkHash = SHA1.ComputeHash(pubkey); bool isGood = SA.VerifySignature(pkHash, sig); return(isGood); }
public string GetSpecialAttack(string specialAttackName) { foreach (string SA in SpecialAttacks) { if (SA.Contains(specialAttackName) && SA.IndexOf(specialAttackName) == 0) { return(SA); } } return(string.Empty); }
public bool HasSpecialAttack(string specialAttackName) { foreach (string SA in SpecialAttacks) { if (SA.Contains(specialAttackName)) { return(true); } } return(false); }
//*Function for mediating the auction public void MediateAuction(int ToD, int[] PreviousStage, Returner ReturnerVariables) { AllPhases.Clear(); foreach (StageAgent SA in Stages) { SA.GenerateBid(ToD); foreach (double PhaseBid in SA.LanePhases) { AllPhases.Add(PhaseBid); } } Strat.ProcessJunction(this, PreviousStage, ReturnerVariables); }
/// <summary> /// 高级管理员修改管理员信息 /// </summary> protected void btnAlter_Click(object sender, EventArgs e) { SA mSa = new SA(); SAController mSaController = new SAController(); //传进UserName的值 if (Session["UserName"] != null) { mSa.UserName = Session["UserName"].ToString(); mSa.PassWord = this.txtPassword.Text; switch (this.txtAdministratorClass.Text) { case "订单管理员": mSa.StaffType = '2'; break; case "评价管理员": mSa.StaffType = '3'; break; case "用户管理员": mSa.StaffType = '4'; break; case "商品管理员": mSa.StaffType = '5'; break; default: //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "您输入的管理员类型无效!请重新输入!" + "');</script> "); break; } if (mSaController.AlterAdmin(mSa) == true) { this.lblCheck.Text = "修改成功!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "修改成功!" + "');</script> "); //在日志表中记录此次操作 mDayBook.StaffID = mAdminController.GetStaffID(mSa, mSa.UserName); mDayBook.UserName = mSa.UserName; mDayBook.HandleTime = DateTime.Now.ToString(); mDayBook.HandleObjects = "普通管理员:" + this.txtStaffName.Text; mDayBook.DayBookVersion = "2"; mDayBookController.AddDayBook(mDayBook); } else { this.lblCheck.Text = "修改失败!请重新操作!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "修改失败!请重新操作!" + "');</script> "); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["surrentPage"] = 0; divide mdv = new divide(); this.AdminList.DataSource = mdv.AdminShow(Convert.ToInt32(ViewState["surrentPage"])); this.AdminList.DataBind(); SA mSA = new SA(); int PageSum = mSA.GetPage(); int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]); ShowPages.Text = "第" + (CurrentPage + 1).ToString() + "页/共" + PageSum + "页"; } }
/// <summary> /// 查看用户信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Enter_Click(object sender, EventArgs e) { SA mSa = new SA(); SAController mSaController = new SAController(); if (mSaController.ExistStoreUser(mSa, this.tbxUserName.Text) == false) { Session["StoreUserName"] = this.tbxUserName.Text; Response.Redirect("SA_StoresUserInfo.aspx"); } else { //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "您输入的用户名不存在!" + "');</script> "); } }
public override void Single() { if (GeneTestSetup.Instance.IsSimulated) { GeneSimulatedData(); } else { SA.ResetInterface(); SA.Span = 0; SA.CenterFreq = SignalFreq; SA.RefLevel = RefLevel; SA.SweepTime = SweepTime; SA.RBW = RecvBW; SA.DetType = SpecAnalyzerDetTypeEnum.POS; SA.VBW = RecvBW; SA.InitContEnable = false; (SA as InstruDriver).Wait(1000); SA.Init(); (SA as InstruDriver).Wait(1000 + (int)(SweepTime * 1000)); SA.MarkerMaxSearch(1); (SA as InstruDriver).Wait(1000); SignalPower = SA.GetMarkerY(1); foreach (HarmTestItem item in ItemList) { SA.CenterFreq = SignalFreq * item.nHarm; SA.Init(); (SA as InstruDriver).Wait(1000 + (int)(SweepTime * 1000)); SA.MarkerMaxSearch(1); (SA as InstruDriver).Wait(1000); double p = SA.GetMarkerY(1); if (item.nHarm == 1) { item.X = SignalFreq; item.Y = p; } else { item.X = SignalFreq; item.Y = p - SignalPower; } } } }
private void btnLogin_Click(object sender, EventArgs e) { if (txtUserName.Text == "sa" && txtpassword.Text == "12345") { // anasayfa.ActiveForm.Visible = false; SA sa = new SA(); sa.ShowDialog(); //this.Hide(); } else { MessageBox.Show("The User name or password you entered is incorrect, try again"); txtpassword.Clear(); txtUserName.Clear(); txtUserName.Focus(); } }
/// <summary> /// 查询订单信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Enter_Click(object sender, EventArgs e) { //实例化高级管理员对象 SA mSa = new SA(); //实例化方法对象 SAController mSacontroller = new SAController(); //判断输入的EvaluateID是否存在 Session["hOrderID"] = this.OrderID.Text; if (mSacontroller.ExistOrderID(mSa, this.OrderID.Text) == true && (this.OrderID.Text != null)) { Response.Redirect("SA_OrderInfo.aspx"); } else { //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "不存在此订单!请重新输入" + "');</script> "); } }
public void setSuccess() { if (!explode.activeSelf && AS.switchCondition && BS.switchCondition && CS.switchCondition && DS.switchCondition) { Success.SetActive(true); Banner.SetActive(false); A.SetActive(false); B.SetActive(false); C.SetActive(false); D.SetActive(false); SA.SetActive(false); SB.SetActive(false); SC.SetActive(false); SD.SetActive(false); light.color = Color.green; Update(); } }
public async Task <TeacherAssignmentModel> getAssignment(string userId) { /* * var query = await(from a in PIDBContext.Assignments * join ar in PIDBContext.Areas on a.AreaId equals ar.Id * join u in PIDBContext.Users on a.UserId equals u.Id * where a.Status == true && ar.Status == true && u.Status == true && * u.Id == userId * select new AssignmentRequestModel * { * id = a.Id.GetValueOrDefault(), * nameArea = ar.Name, * nameUser = u.Name + " " + u.LastName, * areaId = ar.Id, * userId = u.Id * } * ).AsNoTracking().FirstOrDefaultAsync(); * return query; */ var query = await(from teacher in PIDBContext.Users join userRole in PIDBContext.UserRoles on teacher.Id equals userRole.UserId join role in PIDBContext.Roles on userRole.RoleId equals role.Id join assignment in PIDBContext.Assignments on teacher.Id equals assignment.UserId into TA from subassignment in TA.DefaultIfEmpty() join area in PIDBContext.Areas on subassignment.AreaId equals area.Id into SA from subarea in SA.DefaultIfEmpty() where role.NormalizedName == "PROFESOR" && teacher.Status == true && teacher.Id == userId && (subassignment == null ? true : (subassignment.Status == true ? true : false)) select new TeacherAssignmentModel { Id = teacher.Id, Name = teacher.Name, LastName = teacher.LastName, RoleName = role.Name, City = teacher.City, Degree = teacher.Degree, Email = teacher.Email, AreaId = subassignment.AreaId, AreaName = subarea.Name ?? "Sin Area", AssignmentId = subassignment.Id.GetValueOrDefault() }).AsNoTracking().FirstOrDefaultAsync(); return(query); }
/// <summary> /// 上一页 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void last_Click(object sender, EventArgs e) { if (Convert.ToInt32(ViewState["surrentPage"]) > 0) { ViewState["surrentPage"] = Convert.ToInt32(ViewState["surrentPage"]) - 1; divide mdv = new divide(); this.AdminList.DataSource = mdv.AdminShow(Convert.ToInt32(ViewState["surrentPage"])); this.AdminList.DataBind(); } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "已经是第一页!!" + "');</script> "); } SA mSA = new SA(); int PageSum = mSA.GetPage(); int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]); ShowPages.Text = "第" + (CurrentPage + 1).ToString() + "页/共" + PageSum + "页"; }
private string BuildString(int folderID) { if (!loadedValues.ContainsKey(folderID)) // if we dont have the value { using (SA sa = new SA()) using (IRWS irws = new IRWS(sa.Ticket)) lock (this) if (loadedValues.ContainsKey(folderID)) // lets check again (maybe in btween the locks other threads did the job) { lock (_lock) return(loadedValues[folderID]); } else // it looks like we dont have it (now it is populated) { loadedValues[folderID] = irws.getFolderPathfromFolderID(folderID); } } return loadedValues[folderID] }
protected void GridResult_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[3].Text == "PartI") { if (e.Row.Cells[5].Text == "Pass") { PI += 1; } e.Row.BackColor = System.Drawing.Color.AntiqueWhite; } else if (e.Row.Cells[3].Text == "PartII") { if (e.Row.Cells[5].Text == "Pass") { PII += 1; } e.Row.BackColor = System.Drawing.Color.Aquamarine; } else if (e.Row.Cells[3].Text == "SectionA") { if (e.Row.Cells[5].Text == "Pass") { SA += 1; } e.Row.BackColor = System.Drawing.Color.AliceBlue; } else if (e.Row.Cells[3].Text == "SectionB") { if (e.Row.Cells[5].Text == "Pass") { SB += 1; } e.Row.BackColor = System.Drawing.Color.LightCoral; } } lblPartICount.Text = PI.ToString(); lblPartIICount.Text = PII.ToString(); lblSectionACount.Text = SA.ToString(); lblSectionBCount.Text = SB.ToString(); }
protected override void OnStart(string[] args) { string strURI = "ATSAM"; SA pSA = new SA(strURI); try { if (pSA.getStatus() == ErrorCode.ecNone) { HttpChannel hc = new HttpChannel(pSA.getPortNumber()); ChannelServices.RegisterChannel(hc, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(BFL), strURI + "URI", WellKnownObjectMode.Singleton); } } catch (Exception e) { System.Diagnostics.EventLog elEventLog = new System.Diagnostics.EventLog(); elEventLog.WriteEntry(e.Message, EventLogEntryType.Error); } }
public Fingerprint_SA(SA[] sas) { this.fingerprint = sas; this.fingerprint_name = Fingerprint_Name.SA; }
public override void onDestroy() { base.onDestroy(); mAccessory = null; }
public override void onCreate() { base.onCreate(); mAccessory = new SA(); try { mAccessory.initialize(this); } catch (SsdkUnsupportedException e) { // try to handle SsdkUnsupportedException if (processUnsupportedException(e) == true) { return; } } catch (Exception e1) { Console.WriteLine(e1.ToString()); Console.Write(e1.StackTrace); /* * Your application can not use Samsung Accessory SDK. Your application should work smoothly * without using this SDK, or you may want to notify user and close your application gracefully * (release resources, stop Service threads, close UI thread, etc.) */ stopSelf(); } mThread = new HandlerThread("GalleryProvider"); mThread.start(); mLooper = mThread.Looper; if (mLooper != null) { mBackgroundHandler = new Handler(mLooper); } else { throw new Exception("Could not get Looper from Handler Thread"); } }