public override void SetState(ViewState viewState) { if (state == ViewState.Invalid) { return; } state = viewState; Color playerColor = TttGame.instance.player == Player.Player1 ? new Color (0, 1, 0, 0.5f) : new Color (1, 0, 0, 0.5f); //Set All Renderers. foreach (Renderer renderer in renderers) { switch (state) { case ViewState.Acceptable: renderer.material.color = playerColor; break; case ViewState.Invalid: default: renderer.material.color = color; break; } } }
public NavigationObject( GUIListControl control, string title, string itemtype, string nbobjects, string moviecontext, int pos, MyFilms.Layout curview, Configuration curconf, GUISortButtonControl srtButton, GUIButtonControl viewButton, GUIButtonControl layoutButton, CoverState coverstate, DateTime lastDBupdate) { Items = new List<GUIListItem>(); GetItems(control, title, itemtype, pos, curview); ViewStatus = new ViewState(); GetViewStatus(curconf); DbDfltSelect = curconf.DbSelection[0]; DbSelect = curconf.DbSelection[1]; DbField = curconf.DbSelection[2]; DbSort = curconf.DbSelection[3]; bool showall; DbShowAll = Boolean.TryParse(curconf.DbSelection[4], out showall) && showall; bool extrasort; DbExtraSort = Boolean.TryParse(curconf.DbSelection[4], out extrasort) && extrasort; NbObjects = nbobjects; MovieContext = moviecontext; CurrentView = curview; SortButtonEnabled = srtButton.IsEnabled; SortButtonAsc = srtButton.IsAscending; SortButtonLabel = srtButton.Label; ViewAsButtonLabel = viewButton.Label; LayoutButtonLabel = layoutButton.Label; CoverStatus = coverstate; LastDbUpdate = lastDBupdate; }
public virtual void SetState(ViewState viewState) { if (state == ViewState.Invalid) { return; } state = viewState; //Set All Renderers. foreach (Renderer renderer in renderers) { switch (state) { case ViewState.Acceptable: renderer.material.color = Color.green; break; case ViewState.Unacceptable: renderer.material.color = Color.red; break; case ViewState.Possible: renderer.material.color = new Color(0,0.25f,0, 1f); break; case ViewState.Selected: renderer.material.color = Color.red; break; case ViewState.Invalid: default: renderer.material.color = color; break; } } }
public ConsoleView(Gameboard gameboard) { _gameboard = gameboard; _currentViewStat = ViewState.Active; DisplaySetup(); }
public ViewStateInfo(Type stateType, EMode mode) { Type = stateType; Mode = mode; Instance = null; CreateInstance(); }
/// <summary> /// 展示新闻界面 /// </summary> public NewsView(NewsViewModel viewModel, ViewState state) : this() { viewModel.LoadDetails(); GoToState(state); LoadImage(viewModel.NEWSID, state); if (state == ViewState.ADD) { txtDeptId.Text = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; txtDeptName.Text = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName; viewModel.PUTDEPTID = txtDeptId.Text; viewModel.PUTDEPTNAME = txtDeptName.Text; ViewModel = viewModel; return; } viewModel.OnLoadDetailsCompleted += (obj, args) => { ViewModel = viewModel; }; viewModel.OnAddCompleted += (obj, args) => { loading.Stop(); }; viewModel.OnLoadDetailsCompleted += (obj, args) => { loading.Stop(); }; viewModel.OnDataChangedCompleted += (obj, args) => { loading.Stop(); }; // LoadImage(viewModel.NEWSID, state); }
public static void PutQueryToState(RQquery query, UserState.States stateType) { state = (ViewState)UserState.Get(stateType); if (state == null) state = new ViewState(stateType); state.query = query; state.Save(); }
public MainForm() { InitializeComponent(); m_Window = splitContainer1.Panel2; m_CurrentViewState = new NormalViewState(); InitD3D(); SlimDX.Windows.MessagePump.Run(this, Render); }
public static Boolean GetClasstreeOptionsState() { state = (ViewState)UserState.Get(UserState.States.ClasstreeOptionsState); if (state == null) { state = new ViewState(UserState.States.ClasstreeOptionsState); state.query = false; state.Save(); } return (Boolean)state.query; }
private void ChangeView(ViewState state) { while (tcProject.TabPages.Count > 0) tcProject.TabPages.RemoveAt(0); switch (state) { case ViewState.Project: tcProject.TabPages.Add(tpProject); tcProject.TabPages.Add(tpNamespaces); break; } }
public CardStackPresenter(ICardInvokeableStackView view, int defaultRank) { this.view = view; base.OpenDatabase(); model.SetDefaultCardRank(defaultRank); playTimer.Interval = GetRandomPlayTimerDelay(1, 10); playTimer.Stop(); playTimer.Elapsed += new ElapsedEventHandler(_playTimerElapsed); state = ViewState.DISPLAY; }
public static void WriteXML(ViewState viewState, XmlTextWriter writer) { string value; if (viewState == ViewState.Slaved) { value = "Locked"; } else { D.Assert(viewState == ViewState.Unslaved); value = "Unlocked"; } writer.WriteStartElement("ViewState"); writer.WriteAttributeString("Value", value); writer.WriteEndElement(); }
public override void OnNavigatedTo(ParameterList uriParameters, ParameterList parameters, ViewState viewState) { base.OnNavigatedTo(uriParameters, parameters, viewState); // Übergebenen Parameter zwischenspeichern... DateTimeOffset birthday; if (parameters.TryGet<DateTimeOffset>("Birthday", out birthday)) { // ...und Differenz zwischen Geburtsjahr und aktuellem Jahr berechnen var today = DateTime.Today; var age = today.Year - birthday.Year; // Wenn der Geburtstag im aktuellen Jahr noch nicht vorbei ist, ist das berechnete Alter um ein Jahr zu hoch if (today.Month < birthday.Month || (today.Month == birthday.Month && today.Day < birthday.Day)) age--; // Speichern und anzeigen Age = age; } }
/// <summary> /// Builds the actual query. /// </summary> /// <param name="queryString"> /// queryString == null | "" : Rebuilds actual query from stored query state parameters or returns the default query. /// queryString != null : Builds a new query from queryString and stores it in query state parameters. /// </param> /// <param name="stateType"> /// stateType == ListViewState : (Re)builds actual query for ListView. /// stateType == BrowseViewState : (Re)builds actual query for BrowseView. /// stateType == ItemViewState : (Re)builds actual query for SingleItemView. /// </param> /// <returns> /// Actual query. /// </returns> public static RQquery GetQueryFromState(string queryString, UserState.States stateType) { RQquery query = null; state = (ViewState)UserState.Get(stateType); if (state == null) { if (string.IsNullOrEmpty(queryString)) query = new RQquery("$recent$recent additions", "recent"); else query = new RQquery(queryString); state = new ViewState(stateType); //, queryString); state.query = query; //state.Save(); } else { string querytest; UserSettingsService us = new UserSettingsService(); query = (RQquery)state.query; if (! string.IsNullOrEmpty(queryString) && queryString.StartsWith("$") && queryString.LastIndexOf("$") > 1) querytest = queryString.Substring(0, queryString.LastIndexOf("$")+1) + query.QueryString; else querytest = query.QueryString; //if ( (! string.IsNullOrEmpty(queryString) && querytest != queryString) // || (query.QueryExternal == "" && us.GetIncludeExternal() == true) // || (query.QueryExternal != "" && us.GetIncludeExternal() == false) ) //{ // query = new RQquery(! string.IsNullOrEmpty(queryString) ? queryString : query.QueryString); // query.QueryExternal = us.GetIncludeExternal() == true ? "003" : ""; // state.query = query; // //state.Save(); //} if (!string.IsNullOrEmpty(queryString) && querytest != queryString) query = new RQquery(! string.IsNullOrEmpty(queryString) ? queryString : query.QueryString); query.QueryExternal = us.GetIncludeExternal() == true ? "003" : ""; state.query = query; } return query; }
public BattleNetaModel() { LynLoggerMain.OnInstanceCreate += i => { i.MapStartNextObserver.OnMapNext += a => { MapNext = a; _state = ViewState.AnticipateBattle; ShowInfo = ViewShowInfo.MapNext; }; i.PracticeEnemyInfoObserver.OnPracticeEnemyInfo += a => { PracticeEnemy = a; _state = ViewState.AnticipateBattle; ShowInfo = ViewShowInfo.PracticeEnemyInfo; }; i.BattleObserver.OnBattle += a => { switch(_state) { case ViewState.AnticipateBattle: Battle = a; if(a.HasNightWar) { _state = ViewState.AnticipateNightBattle; } else { _state = ViewState.AnticipateBattle; } break; case ViewState.AnticipateNightBattle: if(a.NightWar == null) goto case ViewState.AnticipateBattle; _state = ViewState.AnticipateBattle; var b = Battle.Clone(); b.NightWar = a.NightWar; Battle = b; break; } ShowBattleProcess = true; }; i.BattleResultObserver.OnBattleResult += a => { BattleResult = a; ShowBattleResult = true; }; }; }
//保存 void btnSave_Click(object sender, EventArgs e) { if (txtAccountNew.ReadOnly == true) { UpdateSave(); return; } List <User> ds = DAL.User.GetUserByAccount(txtAccountNew.Text); if (ds.Count > 0) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "message", "alert('用户已存在');document.forms(0).txtAccountNew.select()", true); return; } ds = DAL.User.GetUserByIDCard(txtId.Text); if (ds.Count > 0) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "message", "alert('身份证号码已存在');document.forms(0).txtId.select()", true); return; } ContestDll.User dr = new ContestDll.User(); dr.Account = txtAccountNew.Text; dr.Name = txtNameNew.Text; dr.IDCard = txtId.Text; dr.Sex = rblSex.SelectedValue == "1"?true :false; dr.Telephone = txtTelephone.Text; dr.Email = txtEmail.Text; dr.Flag = 1; dr.SchoolID = int.Parse(ddlSchollNew.SelectedValue); UserRole drRole = new UserRole(); drRole.CreatedBy = DAL.Common.LoginID; drRole.Created = DateTime.Now; drRole.RoleID = int.Parse(rblRole.SelectedValue); drRole.StateID = 1; drRole.Flag = 1; drRole.ContestID = DAL.Common.GetContestID(Page); //这里加的专家和管理员无需审批 try { bool enableUser = true;// ViewState["ShowInfo"] != null; bool succeed = SaveAD(enableUser); if (succeed) { BLL.User.InsertUser(dr, drRole);; ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "message", "alert('保存成功');document.getElementById('divManageUser').style.display='none'", true); Clear(); ViewState.Remove("ShowInfo"); } else { DAL.Common.ShowMessage(Page, this.GetType(), "帐号已经存在!"); } } catch { DAL.Common.ShowMessage(Page, this.GetType(), "保存失败!"); } }
private void LoadInfoToControls() { ListItem itmSelect = new ListItem("انتخاب کنید", "-1"); ListItem itmOther = new ListItem("سایر", "0"); int codeostad = Convert.ToInt32(Session[sessionNames.userID_StudentOstad]); DTO.University.Faculty.editInfoStruct editInfo = FRB.getOstadInf(codeostad); //Session.Add("hrInfoPeopleId", editInfo.hrId); DataTable dtResault = FRB.GetOstadInfoFromHR(codeostad); if (dtResault.Rows.Count == 0) { string msg = "کد استادی شما در هیچ کدام از سامانه ها فعال نیست. لطفا جهت فعال سازی با کارشناس مربوطه تماس حاصل فرمایید"; RadWindowManager1.RadAlert(msg, 400, 200, "پیام سیستم", "RedirectToMain"); return; } Session.Add("hrInfoPeopleId", dtResault.Rows[0]["Id"]); DataTable dtControlToSidaList = FRB.GetAllControlToSidaFields(); txtCodeMeli.Text = editInfo.idd_Melli; txtFirstName.Text = editInfo.name; txtFamily.Text = editInfo.family; txtFatherName.Text = editInfo.fatherName; AddValueToChangeList(codeostad, dtControlToSidaList, txtFatherName.Text, txtFatherName.ID); txtShCode.Text = editInfo.idd; AddValueToChangeList(codeostad, dtControlToSidaList, txtShCode.Text, txtShCode.ID); txtYearBorn.Text = editInfo.salTavalod; AddValueToChangeList(codeostad, dtControlToSidaList, txtYearBorn.Text, txtYearBorn.ID); drpNezam.DataSource = CB.GetStatusMilitary_fcoding(); drpNezam.DataTextField = "namecoding"; drpNezam.DataValueField = "id"; drpNezam.DataBind(); drpNezam.Items.Insert(0, new ListItem(itmSelect.Text, itmSelect.Value)); drpNezam.Items.Insert(drpNezam.Items.Count, new ListItem(itmOther.Text, itmOther.Value)); drpNezam.SelectedValue = editInfo.nezam.ToString(); AddValueToChangeList(codeostad, dtControlToSidaList, drpNezam.SelectedValue, drpNezam.ID + "Value"); rdblMarriage.SelectedValue = editInfo.taahol ? "2" : "1"; AddValueToChangeList(codeostad, dtControlToSidaList, rdblMarriage.SelectedValue, rdblMarriage.ID); rblGender.SelectedValue = editInfo.sexIsMan ? "1" : "2"; AddValueToChangeList(codeostad, dtControlToSidaList, rblGender.SelectedValue, rblGender.ID); if (!editInfo.sexIsMan) { pnlMilitary.Visible = false; } drpLastMaghta.Items.Clear(); drpLastMaghta.DataSource = CB.GetCodingByTypeId(2); drpLastMaghta.DataValueField = "Id"; drpLastMaghta.DataTextField = "namecoding"; drpLastMaghta.DataBind(); drpLastMaghta.Items.Insert(0, new ListItem(itmSelect.Text, itmSelect.Value)); drpLastMaghta.SelectedValue = editInfo.maghta.ToString(); AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.maghta == 0 ? "" : editInfo.maghta.ToString(), drpLastMaghta.ID + "Value"); DataTable dtField = CB.SelectField_fcoding(); for (int i = 0; i <= dtField.Rows.Count - 1; i++) { dtField.Rows[i]["nameresh"] = dtField.Rows[i]["nameresh"].ToString().Replace("ي", "ی"); } drpReshte.DataSource = dtField; drpReshte.DataTextField = "nameresh"; drpReshte.DataValueField = "id"; drpReshte.DataBind(); drpReshte.Items.Insert(0, new RadComboBoxItem(itmSelect.Text, itmSelect.Value)); drpReshte.Items.Insert(drpReshte.Items.Count, new RadComboBoxItem(itmOther.Text, itmOther.Value)); drpReshte.SelectedValue = editInfo.reshte.ToString(); AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.reshte == 0 ? "" : editInfo.reshte.ToString(), drpReshte.ID + "Value"); drpUniversityType.SelectedValue = editInfo.typeUniMadrak.ToString(); AddValueToChangeList(codeostad, dtControlToSidaList, drpUniversityType.SelectedValue, drpUniversityType.ID + "Value"); txtSiba.Text = editInfo.siba; AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.siba, txtSiba.ID); txtYearGetMadrak.Text = editInfo.salMadrak; AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.salMadrak, txtYearGetMadrak.ID); txtSanavat.Text = editInfo.sanavat; AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.sanavat, txtSanavat.ID); DataTable dtCountrySource = CB.GetNameCountry_fcoding(); drpCountry.DataSource = dtCountrySource.Select("id<56").CopyToDataTable(); drpCountry.DataTextField = "namecoding"; drpCountry.DataValueField = "id"; drpCountry.DataBind(); drpCountry.Items.Insert(0, new ListItem(itmSelect.Text, itmSelect.Value)); drpCountry.SelectedValue = editInfo.keshvar.ToString(); AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.keshvar.ToString(), drpCountry.ID + "Value"); DataTable dtUniName = CB.GetNameUni_fcoding(); for (int i = 0; i <= dtUniName.Rows.Count - 1; i++) { dtUniName.Rows[i][0] = dtUniName.Rows[i][0].ToString().Replace("ي", "ی"); } drpUniName.DataSource = dtUniName; drpUniName.DataTextField = "namecoding"; drpUniName.DataValueField = "ID"; drpUniName.DataBind(); drpUniName.Items.Insert(0, new RadComboBoxItem(itmSelect.Text, itmSelect.Value)); drpUniName.Items.Insert(drpUniName.Items.Count, new RadComboBoxItem(itmOther.Text, itmOther.Value)); drpUniName.SelectedValue = editInfo.nameUniMadrak.ToString(); AddValueToChangeList(codeostad, dtControlToSidaList, drpUniName.SelectedValue, drpUniName.ID + "Value"); if (editInfo.bime) { rdblBimehStatus.SelectedValue = "1"; drpBimehType.Enabled = true; txtInsuranceNumber.Enabled = true; drpBimehType.SelectedValue = editInfo.bimeType.ToString(); txtInsuranceNumber.Text = editInfo.bimeNum; drpBimehType.Enabled = true; txtInsuranceNumber.Enabled = true; } else { rdblBimehStatus.SelectedValue = "2"; } AddValueToChangeList(codeostad, dtControlToSidaList, drpBimehType.SelectedValue, drpBimehType.ID + "Value"); AddValueToChangeList(codeostad, dtControlToSidaList, txtInsuranceNumber.Text, txtInsuranceNumber.ID); chbkIsRetired.Checked = editInfo.bazneshaste; AddValueToChangeList(codeostad, dtControlToSidaList, chbkIsRetired.Checked.ToString(), "chbkIsRetired"); ViewState.Add(listOfChanges, ChangeList); getScansAreNotInDB(); }
void Page_PreRender(object sender, EventArgs e) { ViewState.Add("_FleetSeriesDateRace", _fleetSeriesDateRace); // Save State }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["user_server"] != null) { HttpCookie local = Request.Cookies["user_server"]; Users_DAL user = new Users_DAL(); foreach (var item in user.select_All()) { if (item.Email == local.Values["user_email"]) { Label13.Text = "Hi" + " " + item.First_Name; } } } else { Response.Redirect("/User_Pages/User_Main_Page.aspx"); } if (Page.IsPostBack) { ViewState.Add("Bulding_Max_area", Bulding_Max_area.Text); ViewState.Add("Bulding_Min_area", Bulding_Min_area.Text); ViewState.Add("Room_Max_Number", Room_Max_Number.Text); ViewState.Add("Room_Min_Number", Room_Min_Number.Text); ViewState.Add("Total_Max_Cost", Total_Max_Cost.Text); ViewState.Add("Total_Min_Cost", Total_Min_Cost.Text); // ViewState.Add("Purpose", Purpose.SelectedValue); // ViewState.Add("Purpose", TextBox1.Text); //TextBox1.Text = Purpose.SelectedItem.Value; ViewState.Add("Land_Max_area", Land_Max_area.Text); ViewState.Add("Land_Min_area", Land_Min_area.Text); ViewState.Add("Total_Max_Cost_Land", Total_Max_Cost_Land.Text); ViewState.Add("Total_Min_Cost_Land", Total_Min_Cost_Land.Text); } if (!Page.IsPostBack) { //Purpose_Apartment_DAL Purpose_item_building = new Purpose_Apartment_DAL(); //foreach (var item in Purpose_item_building.select_All()) //{ //} //{ // ListItem listitem = new ListItem(item.Name, item.ID.ToString()); // Purpose.Items.Add(listitem); //} Type_property.Items.Add("Building"); Type_property.Items.Add("Lands"); MultiView1.ActiveViewIndex = 0; //Apartments_DAL Apartment = new Apartments_DAL(); //List<string> list = new List<string>(); //foreach (var item in Apartment.select_All()) //{ // ListItem listitem = new ListItem(item.Apartments_Type, item.Apartments_Type); // Type_Of_Building.Items.Add(listitem); // foreach (var item_list in list) // { if (item.Apartments_Type == item_list.ToString()) // Type_Of_Building.Items.Remove(listitem); // } // list.Add(item.Apartments_Type); //} } //............................................................. //Filter_DATA filter_obj=new Filter_DATA(); //int n =int.Parse( Bulding_Max_area.Text); // int x = Convert.ToInt16(Bulding_Miv_area.Text); // int y = Convert.ToInt16(Room_Max_Number.Text); // int z = Convert.ToInt16(Room_Min_Number.Text); // int v = Convert.ToInt16(Total_Max_Cost.Text); // int b = Convert.ToInt16(Total_Min_Cost.Text); //filter_obj.Filter(n,x,y,z,v,b, Location_Search_Building.Text); }
/// <summary> /// Causes the control to track changes to its view state so they can be stored in the object's ViewState property /// 并将ViewState中所有IStateManager类型项标记为TrackViewState /// </summary> /// <remarks> /// Causes the control to track changes to its view state so they can be stored in the object's ViewState property /// 并将ViewState中所有IStateManager类型项标记为TrackViewState /// </remarks> protected override void TrackViewState() { base.TrackViewState(); ViewState.TrackViewState(); }
protected void tabElem_OnTabChanged(object sender, EventArgs e) { ViewState.Add("SelectedControl", tabElem.SelectedTab); DisplayControl(SelectedControl, true); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { int idAdmin = 0; if (Session["Admin"] != null && !string.IsNullOrEmpty(Session["Admin"].ToString())) { idAdmin = int.Parse(Session["Admin"].ToString()); } EvaluacionEntidades.Empleados admin = EvaluacionBL.EmpleadosBL.getEmpleado(idAdmin); if (admin.TipoEmpleado.ToUpper().Contains("ADMIN")) { Session["Admin"] = admin.IdEmpleado; int id = 0; EvaluacionEntidades.Empleados emp = null; if (Request.QueryString["idEmpleado"] != null && int.TryParse(Request.QueryString["idEmpleado"], out id)) { emp = EvaluacionBL.EmpleadosBL.getEmpleado(idEmpleado: id); DateTime desde = DateTime.Today; DateTime desdeSuper = DateTime.Today; DateTime hasta = DateTime.Today.AddDays(15); DateTime hastaSuper = DateTime.Today.AddDays(30); try { DateTime.TryParse(System.Configuration.ConfigurationManager.AppSettings["Desde"], out desde); DateTime.TryParse(System.Configuration.ConfigurationManager.AppSettings["DesdeSuper"], out desdeSuper); DateTime.TryParse(System.Configuration.ConfigurationManager.AppSettings["Hasta"], out hasta); DateTime.TryParse(System.Configuration.ConfigurationManager.AppSettings["HastaSuper"], out hastaSuper); if (desde == DateTime.MinValue) { desde = DateTime.Today; } if (desdeSuper == DateTime.MinValue) { desdeSuper = DateTime.Today.AddDays(16); } if (hasta == DateTime.MinValue) { hasta = DateTime.Today.AddDays(15); } if (hastaSuper == DateTime.MinValue) { hastaSuper = DateTime.Today.AddDays(46); } } catch (Exception ex) { } var eval = EvaluacionBL.EvaluacionBL.GetEvaluacion(IdEmpleado: id, fin: hasta, inicio: desde, inicioSupervisor: desdeSuper, finSupervisor: hastaSuper); pnEvaluacion.Visible = true; litCargo.Text = " value=\"" + emp.Cargo + "\""; litCorreo.Text = " value=\"" + emp.CorreoElectronico + "\""; litDepartamento.Text = " value=\"" + emp.Departamento + "\""; litEmpleadoId.Text = " value=\"" + emp.EmpleadoId + "\""; litIngreso.Text = " value=\"" + emp.Ingreso + "\""; litNegocio.Text = " value=\"" + emp.Negocio + "\""; litNombre.Text = " value=\"" + emp.Nombre + "\""; litPapellido.Text = " value=\"" + emp.PApellido + "\""; litSapellido.Text = " value=\"" + emp.SApellido + "\""; litPia.Text = " value=\"" + emp.NumPia + "\""; Literal1.Text = " value=\"" + eval.Inicio.ToShortDateString() + "\""; Literal2.Text = " value=\"" + eval.Fin.Value.ToShortDateString() + "\""; Literal4.Text = " value=\"" + eval.InicioSupervisor.ToShortDateString() + "\""; Literal5.Text = " value=\"" + eval.FinSupervisor.Value.ToShortDateString() + "\""; hdid.Value = emp.IdEmpleado.ToString(); pnResponsabilidades.Visible = false; pnOportunidades.Visible = false; } else { hdid.Value = "0"; pnEvaluacion.Visible = false; pnResponsabilidades.Visible = true; pnOportunidades.Visible = true; litGrillaResponsabilidad.Text = "<p class=\"text-info pull-center\">El empleado no tiene responsabilidades</p>"; litGrillaOp.Text = "<p class=\"text-info pull-center\">El empleado no tiene Competencias</p>"; } hdidAdmin.Value = admin.IdEmpleado.ToString(); var listEmpleado = EvaluacionBL.EmpleadosBL.GetEmpleadoAdmin(admin.IdEmpleado).ToList().Where(em => em.TipoEmpleado.ToUpper().Contains("SUPERVISOR")); if (listEmpleado != null) { listEmpleado.ToList().ForEach(em => litSupervisorOPtion.Text += "<option value=\"" + em.IdEmpleado + "\" " + ((emp != null && em.IdEmpleado == emp.SupervisorID)?" selected=\"selected\"":"") + " >" + em.nombreCompleto + "</option>"); } string[] niveles = { "Soporte", "Jefes - Gerentes", "Especialistas" }; niveles.ToList().ForEach(n => litniveloption.Text += "<option value=\"" + n + "\" " + ((emp != null && n == emp.Nivel) ? " selected =\"selected\"" : "") + " >" + n + "</option>"); var paises = Helpers.funcionesGenerales.listarReguiones2(); paises.ForEach(i => litPaisoption.Text += "<option value=\"" + i.descripcion + "\" " + ((emp != null && i.descripcion == emp.Pais) ? " selected =\"selected\"" : "") + " >" + i.descripcion + "</option>"); littipooption.Text = "<option value=\"AUTOEVALUADO\" " + ((emp != null && emp.TipoEmpleado.ToUpper() == "AUTOEVALUADO") ? " selected =\"selected\"" : "") + " >AUTOEVALUADO</option><option value=\"AUTOEVALUADO-SUPERVISOR\" " + ((emp != null && emp.TipoEmpleado.ToUpper() == "AUTOEVALUADO-SUPERVISOR") ? " selected =\"selected\"" : "") + " >AUTOEVALUADO - SUPERVISOR</option>"; } else { HttpContext.Current.Session.Clear(); HttpContext.Current.Session.Abandon(); ViewState.Clear(); System.Web.Security.FormsAuthentication.SignOut(); Response.Redirect("/logon.aspx"); } } } catch (Exception) { throw; } }
private void TabsSelectedIndexChanged(object sender, System.EventArgs e) { if (tabs.SelectedTab == null) return; foreach(Control c in tabs.SelectedTab.Controls) { TreeListView v = null; try { v = (TreeListView)c; } catch { /* not interested in exceptions */ } if(v != null) { callTreeView = v; viewState = (ViewState)v.TokenObject; ShowCurrentStack(null, null); return; } } Debug.Fail("Cannot find tree view on the tab page"); }
protected internal virtual void SetDirty() { ViewState.SetDirty(true); }
protected virtual void LoadViewState(object savedState) { ViewState.LoadViewState(savedState); }
public void leverButton_Click(object sender, EventArgs e) { //Define bet int bet = int.Parse(betTextBox.Text); int betReturn = 0; if (bet > playersMoney) { resultLabel2.Text = "You can't bet more money than you have!!"; } else { //Randomly Load Images //Generate three random numbers and put into list List <int> imageNo = new List <int>(); int cherryNo = 0; int sevenNo = 0; int barNo = 0; int otherNo = 0; Random random = new Random(); for (int i = 0; i < 3; i++) { int imageID = random.Next(0, 12); imageNo.Add(imageID); if (imageID == 2) { cherryNo++; } else if (imageID == 9) { sevenNo++; } else if (imageID == 0) { barNo++; } else { otherNo++; } } //Correlate each number in list with Images[] Image1.ImageUrl = string.Format("~/Images/{0}", Images[imageNo[0]]); Image2.ImageUrl = string.Format("~/Images/{0}", Images[imageNo[1]]); Image3.ImageUrl = string.Format("~/Images/{0}", Images[imageNo[2]]); //Determine and display bet result if (barNo >= 1) { int result = bet; resultLabel.Text = string.Format("Sorry, you lost ${0}. Better luck next time.", result); betReturn = -result; } else if (sevenNo == 3) { int result = bet * 100; resultLabel.Text = string.Format("You bet ${0} and won ${1}!", bet, result); betReturn = result; } else if (cherryNo >= 1) { int result = bet * (cherryNo + 1); resultLabel.Text = string.Format("You bet ${0} and won ${1}!", bet, result); betReturn = result; } else { int result = bet; resultLabel.Text = string.Format("Sorry, you lost ${0}. Better luck next time.", result); betReturn = -result; } //Display Player's New Total if (ViewState["playersMoney"] == null) { int playersMoney = 100; int total = playersMoney + betReturn; playerMoneyLabel.Text = string.Format("${0}", total); ViewState.Add("playersMoney", total); } else { int playersMoney = int.Parse(ViewState["playersMoney"].ToString()); int total = playersMoney + betReturn; if (total <= 0) { playerMoneyLabel.Text = string.Format("${0}", total); ViewState.Add("playersMoney", total); resultLabel2.Text = "Sorry, you are out of money! Refresh the page to try your luck again."; } else { playerMoneyLabel.Text = string.Format("${0}", total); ViewState.Add("playersMoney", total); } } //Clear List imageNo.Clear(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SamplingModel sm = new SamplingModel(); if (Session["SamplingsId_Search"] != null && Session["SamplingsId_Search"].ToString().Trim().Length > 0) { sm = SamplingModel.GetSampleById(new Guid(Session["SamplingsId_Search"].ToString())); Session["SamplingsId_Search"] = null; Session.Remove("SamplingsId_Search"); } else if (Request.QueryString["sampleCode"] != null) { sm = SamplingModel.GetSampleBySampleCode(Request.QueryString["sampleCode"]); Session["SamplingsId_Search"] = null; Session.Remove("SamplingsId_Search"); } if (sm != null) { txtResultReceivedDate.Text = DateTime.Now.ToShortDateString(); txtResultReceivedTime.Text = DateTime.Now.ToShortTimeString(); if (sm != null && sm.ID.ToString() != Guid.Empty.ToString()) { ViewState.Add("SelectedSMID", sm.ID); txtSampleCode.Text = sm.SampleCode; txtSamplerName.Text = sm.SamplerName; txtArrivalNoOfBags.Text = sm.ArrivalNumberOfBags.ToString(); txtSampleCodeGeneratedDateStamp.Text = sm.SampleCodeGeneratedTimeStamp.ToShortDateString(); txtSampleCodeGeneratedTimeStamp.Text = sm.SampleCodeGeneratedTimeStamp.ToShortTimeString(); lblCodeGeneratedDate.Text = sm.SampleCodeGeneratedTimeStamp.ToShortDateString() + " " + sm.SampleCodeGeneratedTimeStamp.ToShortTimeString(); if ((Request.QueryString["CommandName"] != null && Request.QueryString["CommandName"].ToUpper() == "Update".ToUpper()) || (sm.IsGraded || sm.IsReSampled)) { txtNumberOfBags.Text = sm.NumberOfBags.ToString(); chkHasChemicalOrPetrol.Checked = sm.HasChemicalOrPetrol != null ? sm.HasChemicalOrPetrol.Value : false; chkHasLiveInsect.Checked = sm.HasLiveInsect != null ? sm.HasLiveInsect.Value : false; chkHasMoldOrFungus.Checked = sm.HasMoldOrFungus != null ? sm.HasMoldOrFungus.Value : false; chkIsPlompOk.Checked = (sm.PlompStatusID == (int)PlompStatus.PlompOK) ? true : false; rbSampleStatus.SelectedValue = sm.SamplingStatusID.ToString(); txtSamplerComments.Text = sm.SamplerComments; if (sm.ResultReceivedDateTime != null) { txtResultReceivedDate.Text = sm.ResultReceivedDateTime.Value.ToShortDateString(); txtResultReceivedTime.Text = sm.ResultReceivedDateTime.Value.ToShortTimeString(); } drpBagType.SelectedValue = sm.BagTypeID.ToString(); if (!chkIsPlompOk.Checked && ((int)SamplingBussiness.SamplingStatus.DriverNotFound) != sm.SamplingStatusID) { reqRemark.Enabled = true; reqRemark.Validate(); } //} if (sm.IsGraded || sm.IsReSampled) { rbSampleStatus.Enabled = txtNumberOfBags.Enabled = txtSamplerComments.Enabled = drpBagType.Enabled = false; chkHasChemicalOrPetrol.Enabled = chkHasLiveInsect.Enabled = chkHasMoldOrFungus.Enabled = chkIsPlompOk.Enabled = false; txtResultReceivedDate.Enabled = txtResultReceivedTime.Enabled = false; btnSaveSampleResult.Enabled = false; btnClear.Enabled = false; btnClear.ToolTip = btnSaveSampleResult.ToolTip = "ReSampled or Graded sample can't be edited!"; } } else { rdSampleStatus_SelectedIndexChanged(null, null); } } } PopulateCombo(sm.CommodityID, sm.VoucherCommodityTypeID); PopulateSampleType(); } RangeValidator2.MinimumValue = DateTime.Now.AddYears(-1).ToShortDateString().ToString(System.Globalization.CultureInfo.InvariantCulture); RangeValidator2.MaximumValue = DateTime.Now.ToShortDateString().ToString(System.Globalization.CultureInfo.InvariantCulture); unBlockUI(); }
protected void Page_Load(object sender, EventArgs e) { // получение данных пользователя UserData userData = UserData.GetUserData(); // проверка входа в систему if (!userData.LoggedOn) { throw new Exception(WebPhrases.NotLoggedOn); } // определение индексов выбранного представления int viewSetIndex, viewIndex; if (!int.TryParse(Request["viewSet"], out viewSetIndex)) { viewSetIndex = -1; } if (!int.TryParse(Request["view"], out viewIndex)) { viewIndex = -1; } // определение номера канала управления int ctrlCnlNum; int.TryParse(Request["ctrlCnlNum"], out ctrlCnlNum); // получение представления и прав пользователя на него BaseView view; MainData.Right right; userData.GetView(null, viewSetIndex, viewIndex, out view, out right); // проверка загрузки представления и прав на отправку команды if (view == null) { throw new Exception(WebPhrases.UnableLoadView); } else if (!right.CtrlRight || !AppData.WebSettings.CmdEnabled || !view.ContainsCtrlCnl(ctrlCnlNum)) { throw new Exception(CommonPhrases.NoRights); } // очистка сообщения об ошибке lblMessage.Text = ""; lblMessage.Visible = false; // установка кнопки по умолчанию Form.DefaultButton = btnExecute.UniqueID; if (IsPostBack) { // восстановление заголовка страницы Title = (string)ViewState["Title"]; // установка активного элемента формы по умолчанию if (pnlPassword.Visible) { Form.DefaultFocus = txtPassword.ClientID; } else { View activeView = mvCommand.Visible ? mvCommand.GetActiveView() : null; if (activeView == viewStandCmd2) { Form.DefaultFocus = txtCmdVal.ClientID; } else if (activeView == viewBinCmd) { Form.DefaultFocus = txtCmdData.ClientID; } } } else { // перевод веб-страницы Localization.TranslatePage(this, "Scada.Web.WFrmCmdSend"); ViewState["Title"] = Title; // вывод свойств канала управления CtrlCnlProps ctrlCnlProps = AppData.MainData.GetCtrlCnlProps(ctrlCnlNum); if (ctrlCnlProps == null) { throw new Exception(string.Format(WebPhrases.OutCnlNotFound, ctrlCnlNum)); } else { lblCtrlCnl.Text = ctrlCnlProps.CtrlCnlName; lblObj.Text = ctrlCnlProps.ObjName; lblKP.Text = ctrlCnlProps.KPName; ViewState.Add("CtrlCnlNum", ctrlCnlProps.CtrlCnlNum); ViewState.Add("KPNum", ctrlCnlProps.KPNum); // установка видимости поля для ввода пароля pnlPassword.Visible = !AppData.WebSettings.SimpleCmd; // установка типа команды и определение фокуса по умолчанию string defaultFocus = ""; if (ctrlCnlProps.CmdTypeID == 0 /*стандартная команда*/) { if (ctrlCnlProps.CmdValArr == null) { // установка представления для ввода значения команды вручную mvCommand.SetActiveView(viewStandCmd2); defaultFocus = txtCmdVal.ClientID; } else if (AppData.WebSettings.SimpleCmd) { // настройка элементов для выполнения команды по нажатию кнопки со значением List <CmdValInfo> cmdValInfoList = new List <CmdValInfo>(); for (int i = 0; i < ctrlCnlProps.CmdValArr.Length; i++) { string cmdText = ctrlCnlProps.CmdValArr[i]; if (cmdText != "") { cmdValInfoList.Add(new CmdValInfo() { CndInd = cmdValInfoList.Count, CmdVal = i, CmdText = cmdText }); } } mvCommand.SetActiveView(viewStandCmd1Simple); repCmdVal.DataSource = cmdValInfoList; repCmdVal.DataBind(); btnExecute.Visible = false; } else { // настройка элементов для выбора значения команды с помощью радиокнопок mvCommand.SetActiveView(viewStandCmd1); for (int i = 0; i < ctrlCnlProps.CmdValArr.Length; i++) { string cmdVal = ctrlCnlProps.CmdValArr[i]; if (cmdVal != "") { rblCmdVal.Items.Add(new ListItem(cmdVal, i.ToString())); } } } } else if (ctrlCnlProps.CmdTypeID == 1 /*бинарная команда*/) { mvCommand.SetActiveView(viewBinCmd); defaultFocus = txtCmdData.ClientID; } else // команда опроса КП { mvCommand.Visible = false; } // установка активного элемента формы по умолчанию if (pnlPassword.Visible) { Form.DefaultFocus = txtPassword.ClientID; } else if (defaultFocus != "") { Form.DefaultFocus = defaultFocus; } } } }
protected void uploadFile_Click(object sender, EventArgs e) { // Save temp file if (translationFile.PostedFile != null) { string tempFileName; if (translationFile.PostedFile.FileName.ToLower().Contains(".zip")) { tempFileName = IOHelper.MapPath(SystemDirectories.Data + "/" + "translationFile_" + Guid.NewGuid().ToString() + ".zip"); } else { tempFileName = IOHelper.MapPath(SystemDirectories.Data + "/" + "translationFile_" + Guid.NewGuid().ToString() + ".xml"); } translationFile.PostedFile.SaveAs(tempFileName); // xml or zip file if (new FileInfo(tempFileName).Extension.ToLower() == ".zip") { // Zip Directory string tempPath = IOHelper.MapPath(SystemDirectories.Data + "/" + "translationFiles_" + Guid.NewGuid().ToString()); // Add the path to the zipfile to viewstate ViewState.Add("zipFile", tempPath); // Unpack the zip file cms.businesslogic.utilities.Zip.UnPack(tempFileName, tempPath, true); // Test the number of xml files try { StringBuilder sb = new StringBuilder(); foreach (FileInfo translationFileXml in new DirectoryInfo(ViewState["zipFile"].ToString()).GetFiles("*.xml")) { try { foreach (Task translation in importTranslatationFile(translationFileXml.FullName)) { sb.Append("<li>" + translation.Node.Text + " <a target=\"_blank\" href=\"preview.aspx?id=" + translation.Id + "\">" + ui.Text("preview") + "</a></li>"); } } catch (Exception ee) { sb.Append("<li style=\"color: red;\">" + ee.ToString() + "</li>"); } } feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; feedback.Text = "<h3>" + ui.Text("translation", "MultipleTranslationDone") + "</h3><p>" + ui.Text("translation", "translationDoneHelp") + "</p><ul>" + sb.ToString() + "</ul>"; } catch (Exception ex) { feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.error; feedback.Text = "<h3>" + ui.Text("translation", "translationFailed") + "</h3><p>" + ex.ToString() + "</>"; } } else { StringBuilder sb = new StringBuilder(); List <Task> l = importTranslatationFile(tempFileName); if (l.Count == 1) { feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; feedback.Text = "<h3>" + ui.Text("translation", "translationDone") + "</h3><p>" + ui.Text("translation", "translationDoneHelp") + "</p><p><a target=\"_blank\" href=\"preview.aspx?id=" + l[0].Id + "\">" + ui.Text("preview") + "</a></p>"; } else { foreach (Task t in l) { sb.Append("<li>" + t.Node.Text + " <a target=\"_blank\" href=\"preview.aspx?id=" + t.Id + "\">" + ui.Text("preview") + "</a></li>"); } feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; feedback.Text = "<h3>" + ui.Text("translation", "MultipleTranslationDone") + "</h3><p>" + ui.Text("translation", "translationDoneHelp") + "</p><ul>" + sb.ToString() + "</ul>"; } } // clean up File.Delete(tempFileName); } }
public frmSuperPutty() { // Verify Putty is set; Prompt user if necessary; exit otherwise dlgFindPutty.PuttyCheck(); InitializeComponent(); // force toolbar locations...designer likes to flip them around this.tsConnect.Location = new System.Drawing.Point(0, 24); this.tsCommands.Location = new System.Drawing.Point(0, 49); if (this.DesignMode) return; // setup connection bar this.tbTxtBoxPassword.TextBox.PasswordChar = '*'; this.RefreshConnectionToolbarData(); // version in status bar this.toolStripStatusLabelVersion.Text = SuperPuTTY.Version; // tool windows this.sessions = new SingletonToolWindowHelper<SessionTreeview>("Sessions", this.DockPanel, x => new SessionTreeview(x.DockPanel)); this.layouts = new SingletonToolWindowHelper<LayoutsList>("Layouts", this.DockPanel); this.logViewer = new SingletonToolWindowHelper<Log4netLogViewer>("Log Viewer", this.DockPanel); // for toolbar this.tbFocusHelperHost = new TextBoxFocusHelper(this.tbTxtBoxHost.TextBox); this.tbFocusHelperUserName = new TextBoxFocusHelper(this.tbTxtBoxLogin.TextBox); this.tbFocusHelperPassword = new TextBoxFocusHelper(this.tbTxtBoxPassword.TextBox); this.sendCommandsDocumentSelector = new frmDocumentSelector(this.DockPanel); this.sendCommandsDocumentSelector.Owner = this; // Hook into status SuperPuTTY.StatusEvent += new Action<string>(delegate(String msg) { this.toolStripStatusLabelMessage.Text = msg; }); SuperPuTTY.ReportStatus("Ready"); // Check for updates if enabled. (disabled if compiled with DEBUG) if (SuperPuTTY.Settings.AutoUpdateCheck) { #if DEBUG Log.Info("Automatic Update Check Disabled in DEBUG mode"); #else Log.Info("Checking for updates"); this.checkForUpdatesToolStripMenuItem_Click(this, new EventArgs()); #endif } // Hook into LayoutChanging/Changed SuperPuTTY.LayoutChanging += new EventHandler<LayoutChangedEventArgs>(SuperPuTTY_LayoutChanging); // Low-Level Mouse and Keyboard hooks llkp = KBHookCallback; kbHookID = SetKBHook(llkp); //llmp = MHookCallback; //mHookID = SetMHook(llmp); this.focusHelper = new ChildWindowFocusHelper(this); this.focusHelper.Start(); // Restore window location and size if (SuperPuTTY.Settings.RestoreWindowLocation) { FormUtils.RestoreFormPositionAndState(this, SuperPuTTY.Settings.WindowPosition, SuperPuTTY.Settings.WindowState); } this.ResizeEnd += new EventHandler(frmSuperPutty_ResizeEnd); // tab switching this.tabSwitcher = new TabSwitcher(this.DockPanel); // full screen this.fullscreenViewState = new ViewState(this); // Apply Settings this.ApplySettings(); this.ApplySettingsToToolbars(); this.DockPanel.ContentAdded += DockPanel_ContentAdded; this.DockPanel.ContentRemoved += DockPanel_ContentRemoved; }
protected void lnkBackHidden_Click(object sender, EventArgs e) { ViewState.Add("SelectedControl", null); DisplayControl(SelectedControlEnum.Listing, true); }
private void MachineViewUpdate() { if (Input.GetKeyUp(KeyCode.Z)) { State = ViewState.SubnetOverview; this.transform.SetParent(null); PivotTransform.SetParent(this.transform); ZoomLerp.Reset(PivotTransform.localPosition, new Vector3(0, 300, -300)); ZoomLerp.Reset(PivotTransform.localRotation, Quaternion.Euler(45, 0, 0)); if (CurrentFocus != CurrentAnchor.transform) { MachineLerp.Reset(this.transform.position, this.CurrentAnchor.transform.position); } return; } if (Input.GetKeyUp(KeyCode.Tab)) { if (CurrentFocus == CurrentAnchor.transform && this.CurrentAnchor.myMachine.AVBattleship != null) { CurrentFocus = this.CurrentAnchor.myMachine.AVBattleship; this.transform.SetParent(CurrentFocus); MachineLerp.Reset(this.transform.position, this.CurrentAnchor.myMachine.AVBattleship.position); } else if (CurrentFocus == CurrentAnchor.transform && this.CurrentAnchor.myMachine.AVCastle != null) { CurrentFocus = this.CurrentAnchor.myMachine.AVCastle; this.transform.SetParent(CurrentFocus); MachineLerp.Reset(this.transform.position, this.CurrentAnchor.myMachine.AVCastle.position); } else { ResetFocusToMachine(); } } if (Input.GetKeyUp(KeyCode.B) && CanStartAVBattleship()) { StartAVOnMachine(); } if (Input.GetKeyUp(KeyCode.Space)) { IsTimeFrozen = !IsTimeFrozen; if (IsTimeFrozen) { InterruptTime.InterruptScale = 0; } else { InterruptTime.InterruptScale = 1; } NoTimeVisual.gameObject.SetActive(IsTimeFrozen); } if (Input.GetKeyUp(KeyCode.Delete)) { if (CurrentLock is SubroutineHarness) { AssignLockTarget(null); CurrentLock.transform.GetComponent<Subroutine>().Die(); } } MachineRaycastUpdate(); MachineSubroutineUpdate(); MachineInputMoveUpdate(); }
/// <summary> /// 设置某属性的值 /// </summary> /// <typeparam name="V">属性类型</typeparam> /// <param name="propertyName">属性名称</param> /// <param name="value">属性值</param> /// <remarks>设置某属性的值</remarks> protected void SetPropertyValue <V>(string propertyName, V value) { ViewState.SetViewStateValue <V>(propertyName, value); }
private void ToggleMenu(bool showMenu) { if (showMenu) { OldState = State; State = ViewState.Menu; } else { State = OldState; } Menu.gameObject.SetActive(showMenu); Crosshair.gameObject.SetActive(!showMenu); HitCrosshair.gameObject.SetActive(!showMenu); Cursor.visible = showMenu; }
/// <summary> /// 从ViewState中获取某属性值,如果为空则返回默认值nullValue /// </summary> /// <typeparam name="V">属性类型</typeparam> /// <param name="propertyName">属性名称</param> /// <param name="nullValue">默认值</param> /// <returns>属性值</returns> /// <remarks>从ViewState中获取某属性值,如果为空则返回默认值nullValue</remarks> protected V GetPropertyValue <V>(string propertyName, V nullValue) { return(ViewState.GetViewStateValue <V>(propertyName, nullValue)); }
public void SelectSystem(Sun sun) { gameState = ViewState.SYSTEM_VIEW; selectedSystem = sun; }
protected void grdListOfRequest_RowCommand(object sender, GridViewCommandEventArgs e) { int reqId = Convert.ToInt32(e.CommandArgument); ViewState.Add("reqId", reqId); if (e.CommandName == "checkReq") { hdnfReqId.Value = reqId.ToString(); List <ResourceControl.Entity.Resource> resList = new List <ResourceControl.Entity.Resource>(); ResourceHandler rsh = new ResourceHandler(); _resList = rsh.GetResourceListByReqID(reqId); ViewState.Add("reqId", reqId); ViewState.Add("_resList", _resList); if (drpRequestTypeList.SelectedIndex == 0 || drpRequestTypeList.SelectedIndex == 3) { drpCandidateResource.DataSource = _resList; drpCandidateResource.DataTextField = "name"; drpCandidateResource.DataValueField = "ID"; drpCandidateResource.DataBind(); drpCandidateResource.Items.Insert(0, new ListItem { Value = "0", Text = "انتخاب کنید..." }); dvSuggestResource.Visible = true; } else { dvSuggestResource.Visible = false; } if (drpRequestTypeList.SelectedIndex == 5) { drpCandidateResource.ClearSelection(); dvOperation.Visible = false; } grdDateTime.EditIndex = -1; RequestDateTimeHandler rqdateTimeH = new RequestDateTimeHandler(); _dateTimeList = rqdateTimeH.GetDateTimeListByRequestId(reqId); grdDateTime.DataSource = _dateTimeList; grdDateTime.DataBind(); string scrp = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true); } if (e.CommandName == "info") { RequestHandler reqHandler = new RequestHandler(); int counter = reqHandler.InformUserOfRequestByReqId(reqId, Session[sessionNames.userID_Karbar].ToString()); string msg = null; if (counter > 0) { msg = "درخواست شماره " + reqId + " با موفقیت اطلاع رسانی شد."; } else { msg = "خطا در اطلاع رسانی درخواست ، لطفا دوباره تلاش کنید."; } RadWindowManager1.RadAlert(msg, 300, 100, "پیام سیستم", "refresgGrid"); } if (e.CommandName == "edit") { Response.Redirect("UserEditRequest.aspx?id=" + generaterandomstr() + "@A" + "0" + "-" + generaterandomstr() + "&reqId=" + e.CommandArgument); } if (e.CommandName == "delete") { RequestHandler rh = new RequestHandler(); rh.DeleteRequest(reqId); //log var commanBusiness = new CommonBusiness(); userID = Convert.ToInt32(Session[sessionNames.userID_Karbar]); //124=حذف درخواست کلاس توسط آموزش commanBusiness.InsertIntoUserLog(userID, "", 11, 124, "حذف درخواست کلاس توسط آموزش", reqId); GridBind(Convert.ToInt32(drpRequestTypeList.SelectedValue)); } if (e.CommandName == "showInfo") { #region ShowInfo hdnfReqId.Value = reqId.ToString(); RequestHandler rh = new RequestHandler(); GridViewRow curruntRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer); imgStatus2.ImageUrl = ((Image)curruntRow.Cells[2].FindControl("imgStatus")).ImageUrl; var requestDetails = rh.GetRequestDetails(reqId); lblRequestId.Text = requestDetails.ID.ToString(); lblDarkhast.Text = requestDetails.CourseName; lbldateOfRequest.Text = requestDetails.Issue_time; RequestDateTimeHandler rqdateTimeH = new RequestDateTimeHandler(); _dateTimeList = rqdateTimeH.GetDateTimeListByRequestId(reqId); var dateTime = _dateTimeList.OrderBy(c => c.Date).FirstOrDefault(c => c.Date != null); if (dateTime != null) { lblRequest.Text = dateTime.Date; } //var requestDateTime = requestDetails.DateTimeRange.FirstOrDefault(c => c.Date != null); //if (requestDateTime != null) //{ // var firstOrDefault = requestDetails.DateTimeRange.FirstOrDefault(c => c.StartTime != 0).Date; // if (firstOrDefault != null) // lblRequest.Text = firstOrDefault; //} var startTime = _dateTimeList.FirstOrDefault(c => c.StartTime != 0); if (startTime != null) { lblTime1.Text = TimeSpan.FromTicks((long)startTime.StartTime).ToString().Substring(0, 5); } var endTime = _dateTimeList.FirstOrDefault(c => c.EndTime != 0); if (endTime != null) { lblTime2.Text = TimeSpan.FromTicks((long)endTime.EndTime).ToString().Substring(0, 5); } switch (requestDetails.Status) { case 1: lblStatue.Text = "درخواست ارجاع داده شده است"; break; case 2: lblStatue.Text = "درخواست شما مورد تایید واقع گردیده"; break; case 3: lblStatue.Text = "درخواست شما مورد تایید واقع نگردیده"; break; case 4: lblStatue.Text = "درخواست شمااطلاع رسانی شده است"; break; } lblTozieh.Text = requestDetails.Note; lblCapecity.Text = requestDetails.Capacity.ToString(); lblLocation.Text = requestDetails.Location; if (!string.IsNullOrEmpty(requestDetails.Answer_time)) { if (requestDetails.Status == 2) { lblheader.Text = "زمان پاسخ به درخواست:"; } else { lblheader.Text = "زمان رد درخواست:"; litDenyNot.Text = "علت رد درخواست:"; } lblheader.Visible = true; lblDateOfResponse.Visible = true; lblDateOfResponse.Text = requestDetails.Answer_time; if (requestDetails.Status != 2) { litDenyNot.Visible = true; lblDenyNot.Visible = true; lblDenyNot.Text = requestDetails.Answernote; } } else { lblheader.Visible = false; lblDateOfResponse.Visible = false; litDenyNot.Visible = false; lblDenyNot.Visible = false; } var requestDateTimes = _dateTimeList.OrderBy(d => d.Date); if (requestDateTimes.Count() > 1) { tblRangeOfDate.Visible = true; } else { tblRangeOfDate.Visible = false; } if (requestDateTimes.Any()) { tblRangeOfDate.Visible = true; grdOldDateTime.DataSource = requestDateTimes; grdOldDateTime.DataBind(); } if (drpRequestTypeList.SelectedItem.Value == 2.ToString() || drpRequestTypeList.SelectedItem.Value == 4.ToString()) { tdRangeOfDate.Visible = false; tdGrdResult.Visible = true; _dateTimeList = rqdateTimeH.GetDateTimeListByRequestId(reqId); grdResult.DataSource = _dateTimeList.OrderBy(c => c.Date); grdResult.DataBind(); } else { tdRangeOfDate.Visible = true; tdGrdResult.Visible = false; } string scrp = "function f(){$find(\"" + RadWindow3.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true); #endregion } if (e.CommandName == "History") { CommonBusiness cmb = new CommonBusiness(); lst_history.DataSource = cmb.GetUserLogByModifyId(int.Parse(e.CommandArgument.ToString()), 11); lst_history.DataBind(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } }
/// <summary> /// Sets the view into a particular state, enabling and disabling all controls /// based on that state. /// </summary> private void SetViewState(ViewState viewState) { switch (viewState) { case ViewState.LoggedOut: _synchronizationContext.Post(async ignored => { Reset(); ViewInvitesCommand.IsEnabled = false; RemoveItemsCommand.IsEnabled = false; ShowUserSearchCommand.IsEnabled = false; ShowNewListCommand.IsEnabled = false; ShowAddItemCommand.IsEnabled = false; LeaveListCommand.IsEnabled = false; RefreshCommand.IsEnabled = false; await Login(); }, null); break; case ViewState.NoLists: ShowNewListCommand.IsEnabled = true; ShowAddItemCommand.IsEnabled = false; ViewInvitesCommand.IsEnabled = false; RemoveItemsCommand.IsEnabled = false; ShowUserSearchCommand.IsEnabled = false; LeaveListCommand.IsEnabled = false; RefreshCommand.IsEnabled = true; break; case ViewState.ListSelected: ShowNewListCommand.IsEnabled = true; ShowAddItemCommand.IsEnabled = true; RefreshCommand.IsEnabled = true; ShowUserSearchCommand.IsEnabled = true; LeaveListCommand.IsEnabled = true; ViewInvitesCommand.IsEnabled = false; break; default: break; } ViewState = viewState; }
public void attachView(ViewState view) { this.view = view; }
//Visual idle state, basically the ai is just looking forward IEnumerator VIdleState() { vIdleTimer = 0; Transform target = GameObject.FindWithTag ("Player").transform; while (viewState == ViewState.VIdle) { //Vision cone calculation vIdleTimer++; Vector3 targetDir = target.position - transform.position; Vector3 forward = transform.forward; float angle = Vector3.Angle(targetDir, forward); //Check to see if there is an object is between the ai and the player if (angle < visionAngle) { RaycastHit hit; if (Physics.Raycast(transform.position, targetDir, out hit)) { if(hit.transform == target) { seesPlayer = true; viewState = ViewState.VFocus; } } } if(vIdleTimer > vIdleTime && !flee) viewState = ViewState.VSearch; yield return 0; } NextViewState (); }
protected virtual object SaveViewState() { return(ViewState.SaveViewState()); }
//protected void gvPELList_RowCommand(object sender, GridViewCommandEventArgs e) //{ // string sRegistrationID = e.CommandArgument.ToString(); // if (e.CommandName.ToUpper() == "ADDENDUM") // Response.Redirect("PELAddAddendum.aspx?RegistrationID=" + sRegistrationID, true); // else // Response.Redirect("PELEdit.aspx?RegistrationID=" + sRegistrationID, true); //} protected void ddlMissedEvents_SelectedIndexChanged(object sender, EventArgs e) { SortedList sParams = new SortedList(); sParams.Add("@EventID", ddlMissedEvents.SelectedValue); sParams.Add("@UserID", Master.UserID); DataSet dsEventInfo = Classes.cUtilities.LoadDataSet("uspGetEventInfo", sParams, "LARPortal", Master.UserName, "EventRegistration.gvEvents_RowCommand"); dsEventInfo.Tables[0].TableName = "EventInfo"; dsEventInfo.Tables[1].TableName = "Housing"; dsEventInfo.Tables[2].TableName = "PaymentType"; if (dsEventInfo.Tables.Count >= 5) { dsEventInfo.Tables[3].TableName = "Character"; dsEventInfo.Tables[4].TableName = "Teams"; dsEventInfo.Tables[5].TableName = "Registration"; dsEventInfo.Tables[6].TableName = "RolesForEvent"; dsEventInfo.Tables[7].TableName = "RegistrationStatuses"; dsEventInfo.Tables[8].TableName = "Meals"; dsEventInfo.Tables[9].TableName = "PlayerInfo"; dsEventInfo.Tables[10].TableName = "CampaignPELs"; dsEventInfo.Tables[11].TableName = "EventPELs"; dsEventInfo.Tables[12].TableName = "AllCharactersForUser"; } foreach (DataRow dRow in dsEventInfo.Tables["EventInfo"].Rows) { DateTime dtStartDate; DateTime dtEndDate; if ((DateTime.TryParse(dRow["StartDate"].ToString(), out dtStartDate)) && (DateTime.TryParse(dRow["EndDate"].ToString(), out dtEndDate))) { ViewState["EventStartDate"] = dtStartDate.ToShortDateString(); ViewState["EventEndDate"] = dtEndDate.ToShortDateString(); ViewState["EventStartTime"] = dRow["StartTime"].ToString(); ViewState["EventEndTime"] = dRow["EndTime"].ToString(); } else { ViewState.Remove("EventStartDate"); ViewState.Remove("EventEndDate"); ViewState.Remove("EventStartTime"); ViewState.Remove("EventEndTime"); } } if (dsEventInfo.Tables["AllCharactersForUser"].Rows.Count > 0) // if (dsEventInfo.Tables["Character"].Rows.Count > 0) { ddlCharacterList.DataSource = dsEventInfo.Tables["AllCharactersForUser"]; //["Character"]; ddlCharacterList.DataTextField = "CharacterAKA"; ddlCharacterList.DataValueField = "CharacterID"; ddlCharacterList.DataBind(); ddlCharacterList.SelectedIndex = 0; ddlCharacterList.Visible = true; lblCharacter.Visible = false; hidSkillSetID.Value = ""; } if (dsEventInfo.Tables["AllCharactersForUser"].Rows.Count == 1) // if (dsEventInfo.Tables["Character"].Rows.Count == 1) { ddlCharacterList.Visible = false; lblCharacter.Visible = true; lblCharacter.Text = ddlCharacterList.Items[0].Text; hidSkillSetID.Value = dsEventInfo.Tables["AllCharactersForUser"].Rows[0]["CharacterSkillSetID"].ToString(); } DataView dvJustRoleNames = new DataView(dsEventInfo.Tables["RolesForEvent"], "", "", DataViewRowState.CurrentRows); DataTable dtJustRoleNames = dvJustRoleNames.ToTable(true, "RoleAlignmentID", "Description"); ddlRoles.DataSource = dtJustRoleNames; ddlRoles.DataTextField = "Description"; ddlRoles.DataValueField = "RoleAlignmentID"; ddlRoles.DataBind(); if (dtJustRoleNames.Rows.Count == 1) { ddlRoles.Visible = false; lblRole.Text = ddlRoles.Items[0].Text; lblRole.Visible = true; } else { if (dtJustRoleNames.Rows.Count > 1) { lblRole.Visible = false; ddlRoles.Visible = true; ddlRoles.Items[0].Selected = true; } } ddlSendToCampaign.ClearSelection(); foreach (DataRow dCharInfo in dsEventInfo.Tables["AllCharactersForUser"].Rows) { lblCharacter.Text = dCharInfo["CharacterAKA"].ToString().Trim(); } if (IsPostBack) { ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openRegistration();", true); } }
protected void BtnCloseClick(object sender, EventArgs e) { ViewState.Clear(); Session.Remove(FreqActiveChart01ID); ScriptManager.RegisterStartupScript(this, typeof(string), "CLOSE_WINDOW", "window.close();", true); }
internal void SetDirty() { ViewState.SetDirty(true); }
private void threadIDList_SelectedValueChanged(object sender, System.EventArgs e) { int selectedThread = (int)threadIDList.SelectedItem; if(selectedThread != currentThreadId) { TreeListView oldTreeView = callTreeView; if(oldTreeView != null) { oldTreeView.Visible = false; oldTreeView.Dock = DockStyle.None; } currentThreadId = selectedThread; callTreeView = threads[selectedThread].callTreeView; callTreeView.Dock = DockStyle.Left; if(oldTreeView != null) { callTreeView.Size = oldTreeView.Size; } viewState = (ViewState)callTreeView.TokenObject; CallTreeForm_Resize(null, null); callTreeView.Visible = true; ShowCurrentStack(null, null); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { TextBox60.Enabled = false; TextBox4.Enabled = false; TextBox75.Enabled = false; DropDownList1.DataValueField = "Cmp_No"; DropDownList1.DataTextField = "Cmp_Nm"; DropDownList1.DataSource = db.MainCmpnam.ToList(); DropDownList1.DataBind(); TextBox17.Text = DropDownList1.SelectedValue; DropDownList2.DataValueField = "Brn_No"; DropDownList2.DataTextField = "Brn_NmAr"; DropDownList2.DataSource = db.MainBranch.ToList(); DropDownList2.DataBind(); int id = int.Parse(Request.QueryString["no"]); var cn = db.MtsItmMfs.Where(o => o.Itm_No == id).SingleOrDefault(); ViewState.Add("id", id); TextBox60.Text = cn.Level_No.ToString(); RadioButtonList1.SelectedValue = cn.Level_Status.ToString(); TextBox2.Text = cn.Itm_NmAr; TextBox3.Text = cn.Itm_NmEn; DropDownList3.SelectedValue = cn.Sup_No.ToString(); TextBox4.Text = cn.Itm_No.ToString(); //CheckBox9.Checked = cn.Prct_Discount; TextBox16.Text = cn.Prct_SalBouns.ToString(); TextBox19.Text = cn.Taxp_Extra.ToString(); TextBox18.Text = cn.Req_Limit.ToString(); TextBox47.Text = cn.MaxQty_SaL.ToString(); // //تفاصيل الصنف field DropDownList4.SelectedValue = cn.Unit_No.ToString(); DropDownList13.SelectedValue = cn.UnitPur_No.ToString(); DropDownList14.SelectedValue = cn.UnitSaL_No.ToString(); TextBox14.Text = cn.Itm_Sal1.ToString(); TextBox1.Text = cn.Itm_Sal2.ToString(); TextBox63.Text = cn.Ref_No.ToString(); TextBox24.Text = cn.Itm_COst.ToString(); TextBox64.Text = cn.Label_No.ToString(); var cn1 = db.MtsItmfsunit.Where(o => o.Itm_No == id).SingleOrDefault(); DropDownList8.SelectedValue = cn1.Unit_No.ToString(); TextBox75.Text = cn1.Itm_No.ToString(); TextBox76.Text = cn1.Unit_Ratio.ToString(); TextBox77.Text = cn1.Unit_Sal1.ToString(); TextBox78.Text = cn1.Unit_Pur.ToString(); TextBox79.Text = cn1.Unit_Cost.ToString(); // TextBox23.Text = cn.Label_No.ToString(); // // CheckBox11.Checked = cn.Chk_Qty2; // // CheckBox10.Checked = cn.Chk_Qty3; // //تفاصيل الشد للصنف // int no = int.Parse(DropDownList1.SelectedValue); // var cn1 = db.MtsItmfsunit.Where(o => o.Cmp_No == no); load_tree(); } }
private void ExitFileViewer() { State = OldState; FileViewer.gameObject.SetActive(false); FileViewerImage.rectTransform.localScale = Vector3.one; Cursor.visible = false; Time.timeScale = 1; }
/// <summary> /// Clears the row ids and item indexes states /// </summary> public void ClearViewStateRowIdsandItemIndexes() { ViewState.Remove("RowIds"); ViewState.Remove("RowIdxs"); }
private void SubnetViewUpdate() { if (Input.GetKeyUp(KeyCode.Z)) { State = ViewState.LockedToMachine; PivotTransform.SetParent(strategyPitchSphere); ZoomLerp.Reset(PivotTransform.localPosition, MachineViewPivotLocalPosition); ZoomLerp.Reset(PivotTransform.localRotation, Quaternion.identity); return; } if (Input.GetKeyUp(KeyCode.W)) { GoToAnchor(CurrentAnchor.Forward); } else if (Input.GetKeyUp(KeyCode.A)) { GoToAnchor(CurrentAnchor.Left); } else if (Input.GetKeyUp(KeyCode.S)) { GoToAnchor(CurrentAnchor.Backward); } else if (Input.GetKeyUp(KeyCode.D)) { GoToAnchor(CurrentAnchor.Right); } SetCrosshairToMousePosition(); }
protected void Page_PreRender(object sender, EventArgs e) { ViewState.Add("order", order); }
private void ToggleToCollectibleState() { OldState = State; State = ViewState.CollectibleView; }
/// <summary> /// Adds a node to the set. /// </summary> public void Export(ISystemContext context, NodeState node) { if (node == null) { throw new ArgumentNullException("node"); } if (Opc.Ua.NodeId.IsNull(node.NodeId)) { throw new ArgumentException("A non-null NodeId must be specified."); } UANode exportedNode = null; switch (node.NodeClass) { case NodeClass.Object: { BaseObjectState o = (BaseObjectState)node; UAObject value = new UAObject(); value.EventNotifier = o.EventNotifier; if (o.Parent != null) { value.ParentNodeId = ExportAlias(o.Parent.NodeId, context.NamespaceUris); } exportedNode = value; break; } case NodeClass.Variable: { BaseVariableState o = (BaseVariableState)node; UAVariable value = new UAVariable(); value.DataType = ExportAlias(o.DataType, context.NamespaceUris); value.ValueRank = o.ValueRank; value.ArrayDimensions = Export(o.ArrayDimensions); value.AccessLevel = o.AccessLevel; value.UserAccessLevel = o.UserAccessLevel; value.MinimumSamplingInterval = o.MinimumSamplingInterval; value.Historizing = o.Historizing; if (o.Parent != null) { value.ParentNodeId = ExportAlias(o.Parent.NodeId, context.NamespaceUris); } if (o.Value != null) { XmlEncoder encoder = CreateEncoder(context); Variant variant = new Variant(o.Value); encoder.WriteVariantContents(variant.Value, variant.TypeInfo); XmlDocument document = new XmlDocument(); document.InnerXml = encoder.Close(); value.Value = document.DocumentElement; } exportedNode = value; break; } case NodeClass.Method: { MethodState o = (MethodState)node; UAMethod value = new UAMethod(); value.Executable = o.Executable; value.UserExecutable = o.UserExecutable; if (o.Parent != null) { value.ParentNodeId = ExportAlias(o.Parent.NodeId, context.NamespaceUris); } exportedNode = value; break; } case NodeClass.View: { ViewState o = (ViewState)node; UAView value = new UAView(); value.ContainsNoLoops = o.ContainsNoLoops; exportedNode = value; break; } case NodeClass.ObjectType: { BaseObjectTypeState o = (BaseObjectTypeState)node; UAObjectType value = new UAObjectType(); value.IsAbstract = o.IsAbstract; exportedNode = value; break; } case NodeClass.VariableType: { BaseVariableTypeState o = (BaseVariableTypeState)node; UAVariableType value = new UAVariableType(); value.IsAbstract = o.IsAbstract; value.DataType = ExportAlias(o.DataType, context.NamespaceUris); value.ValueRank = o.ValueRank; value.ArrayDimensions = Export(o.ArrayDimensions); if (o.Value != null) { XmlEncoder encoder = CreateEncoder(context); Variant variant = new Variant(o.Value); encoder.WriteVariantContents(variant.Value, variant.TypeInfo); XmlDocument document = new XmlDocument(); document.InnerXml = encoder.Close(); value.Value = document.DocumentElement; } exportedNode = value; break; } case NodeClass.DataType: { DataTypeState o = (DataTypeState)node; UADataType value = new UADataType(); value.IsAbstract = o.IsAbstract; value.Definition = Export(o.Definition, context.NamespaceUris); exportedNode = value; break; } case NodeClass.ReferenceType: { ReferenceTypeState o = (ReferenceTypeState)node; UAReferenceType value = new UAReferenceType(); value.IsAbstract = o.IsAbstract; value.InverseName = Export(new Opc.Ua.LocalizedText[] { o.InverseName }); value.Symmetric = o.Symmetric; exportedNode = value; break; } } exportedNode.NodeId = Export(node.NodeId, context.NamespaceUris); exportedNode.BrowseName = Export(node.BrowseName, context.NamespaceUris); exportedNode.DisplayName = Export(new Opc.Ua.LocalizedText[] { node.DisplayName }); exportedNode.Description = Export(new Opc.Ua.LocalizedText[] { node.Description }); exportedNode.WriteMask = (uint)node.WriteMask; exportedNode.UserWriteMask = (uint)node.UserWriteMask; if (!String.IsNullOrEmpty(node.SymbolicName) && node.SymbolicName != node.BrowseName.Name) { exportedNode.SymbolicName = node.SymbolicName; } // export references. INodeBrowser browser = node.CreateBrowser(context, null, null, true, BrowseDirection.Both, null, null, true); List <Reference> exportedReferences = new List <Reference>(); IReference reference = browser.Next(); while (reference != null) { Reference exportedReference = new Reference(); exportedReference.ReferenceType = ExportAlias(reference.ReferenceTypeId, context.NamespaceUris); exportedReference.IsForward = !reference.IsInverse; exportedReference.Value = Export(reference.TargetId, context.NamespaceUris, context.ServerUris); exportedReferences.Add(exportedReference); reference = browser.Next(); } exportedNode.References = exportedReferences.ToArray(); // add node to list. UANode[] nodes = null; int count = 1; if (this.Items == null) { nodes = new UANode[count]; } else { count += this.Items.Length; nodes = new UANode[count]; Array.Copy(this.Items, nodes, this.Items.Length); } nodes[count - 1] = exportedNode; this.Items = nodes; // recusively process children. List <BaseInstanceState> children = new List <BaseInstanceState>(); node.GetChildren(context, children); for (int ii = 0; ii < children.Count; ii++) { Export(context, children[ii]); } }
public void UnselectSystem() { gameState = ViewState.GALACTIC_VIEW; selectedSystem = null; }
/// <summary> /// Imports a node from the set. /// </summary> private NodeState Import(ISystemContext context, UANode node) { NodeState importedNode = null; NodeClass nodeClass = NodeClass.Unspecified; if (node is UAObject) { nodeClass = NodeClass.Object; } else if (node is UAVariable) { nodeClass = NodeClass.Variable; } else if (node is UAMethod) { nodeClass = NodeClass.Method; } else if (node is UAObjectType) { nodeClass = NodeClass.ObjectType; } else if (node is UAVariableType) { nodeClass = NodeClass.VariableType; } else if (node is UADataType) { nodeClass = NodeClass.DataType; } else if (node is UAReferenceType) { nodeClass = NodeClass.ReferenceType; } else if (node is UAView) { nodeClass = NodeClass.View; } switch (nodeClass) { case NodeClass.Object: { UAObject o = (UAObject)node; BaseObjectState value = new BaseObjectState(null); value.EventNotifier = o.EventNotifier; importedNode = value; break; } case NodeClass.Variable: { UAVariable o = (UAVariable)node; NodeId typeDefinitionId = null; if (node.References != null) { for (int ii = 0; ii < node.References.Length; ii++) { Opc.Ua.NodeId referenceTypeId = ImportNodeId(node.References[ii].ReferenceType, context.NamespaceUris, true); bool isInverse = !node.References[ii].IsForward; Opc.Ua.ExpandedNodeId targetId = ImportExpandedNodeId(node.References[ii].Value, context.NamespaceUris, context.ServerUris); if (referenceTypeId == ReferenceTypeIds.HasTypeDefinition && !isInverse) { typeDefinitionId = Opc.Ua.ExpandedNodeId.ToNodeId(targetId, context.NamespaceUris); break; } } } BaseVariableState value = null; if (typeDefinitionId == Opc.Ua.VariableTypeIds.PropertyType) { value = new PropertyState(null); } else { value = new BaseDataVariableState(null); } value.DataType = ImportNodeId(o.DataType, context.NamespaceUris, true); value.ValueRank = o.ValueRank; value.ArrayDimensions = ImportArrayDimensions(o.ArrayDimensions); value.AccessLevel = o.AccessLevel; value.UserAccessLevel = o.UserAccessLevel; value.MinimumSamplingInterval = o.MinimumSamplingInterval; value.Historizing = o.Historizing; if (o.Value != null) { XmlDecoder decoder = CreateDecoder(context, o.Value); TypeInfo typeInfo = null; value.Value = decoder.ReadVariantContents(out typeInfo); decoder.Close(); } importedNode = value; break; } case NodeClass.Method: { UAMethod o = (UAMethod)node; MethodState value = new MethodState(null); value.Executable = o.Executable; value.UserExecutable = o.UserExecutable; importedNode = value; break; } case NodeClass.View: { UAView o = (UAView)node; ViewState value = new ViewState(); value.ContainsNoLoops = o.ContainsNoLoops; importedNode = value; break; } case NodeClass.ObjectType: { UAObjectType o = (UAObjectType)node; BaseObjectTypeState value = new BaseObjectTypeState(); value.IsAbstract = o.IsAbstract; importedNode = value; break; } case NodeClass.VariableType: { UAVariableType o = (UAVariableType)node; BaseVariableTypeState value = new BaseDataVariableTypeState(); value.IsAbstract = o.IsAbstract; value.DataType = ImportNodeId(o.DataType, context.NamespaceUris, true); value.ValueRank = o.ValueRank; value.ArrayDimensions = ImportArrayDimensions(o.ArrayDimensions); if (o.Value != null) { XmlDecoder decoder = CreateDecoder(context, o.Value); TypeInfo typeInfo = null; value.Value = decoder.ReadVariantContents(out typeInfo); decoder.Close(); } importedNode = value; break; } case NodeClass.DataType: { UADataType o = (UADataType)node; DataTypeState value = new DataTypeState(); value.IsAbstract = o.IsAbstract; value.Definition = Import(o.Definition, context.NamespaceUris); importedNode = value; break; } case NodeClass.ReferenceType: { UAReferenceType o = (UAReferenceType)node; ReferenceTypeState value = new ReferenceTypeState(); value.IsAbstract = o.IsAbstract; value.InverseName = Import(o.InverseName); value.Symmetric = o.Symmetric; importedNode = value; break; } } importedNode.NodeId = ImportNodeId(node.NodeId, context.NamespaceUris, false); importedNode.BrowseName = ImportQualifiedName(node.BrowseName, context.NamespaceUris); importedNode.DisplayName = Import(node.DisplayName); importedNode.Description = Import(node.Description); importedNode.WriteMask = (AttributeWriteMask)node.WriteMask; importedNode.UserWriteMask = (AttributeWriteMask)node.UserWriteMask; if (!String.IsNullOrEmpty(node.SymbolicName)) { importedNode.SymbolicName = node.SymbolicName; } if (node.References != null) { BaseInstanceState instance = importedNode as BaseInstanceState; BaseTypeState type = importedNode as BaseTypeState; for (int ii = 0; ii < node.References.Length; ii++) { Opc.Ua.NodeId referenceTypeId = ImportNodeId(node.References[ii].ReferenceType, context.NamespaceUris, true); bool isInverse = !node.References[ii].IsForward; Opc.Ua.ExpandedNodeId targetId = ImportExpandedNodeId(node.References[ii].Value, context.NamespaceUris, context.ServerUris); if (instance != null) { if (referenceTypeId == ReferenceTypeIds.HasModellingRule && !isInverse) { instance.ModellingRuleId = Opc.Ua.ExpandedNodeId.ToNodeId(targetId, context.NamespaceUris); continue; } if (referenceTypeId == ReferenceTypeIds.HasTypeDefinition && !isInverse) { instance.TypeDefinitionId = Opc.Ua.ExpandedNodeId.ToNodeId(targetId, context.NamespaceUris); continue; } } if (type != null) { if (referenceTypeId == ReferenceTypeIds.HasSubtype && isInverse) { type.SuperTypeId = Opc.Ua.ExpandedNodeId.ToNodeId(targetId, context.NamespaceUris); continue; } } importedNode.AddReference(referenceTypeId, isInverse, targetId); } } return(importedNode); }
//Focus on player IEnumerator VFocusState() { Transform target = GameObject.FindWithTag ("Player").transform; while (viewState == ViewState.VFocus) { //Vision Cone calculation Vector3 targetDir = target.position - transform.position; Vector3 forward = transform.forward; float angle = Vector3.Angle(targetDir, forward); if (angle > visionAngle) viewState = ViewState.VIdle; else { RaycastHit hit; //Check if there are any objects in the way if (Physics.Raycast(transform.position, targetDir, out hit)) { if(hit.transform == target) { //Tell other AI where player is GameObject[] objArray = GameObject.FindGameObjectsWithTag ("Enemy"); AIClass[] enemyArray = new AIClass[objArray.Length]; for(int i = 0; i < enemyArray.Length; i++) { enemyArray[i] = (AIClass)objArray[i].GetComponent(typeof(AIClass)); if(i >= enemyArray.Length/2) { //Debug.Log ("AI: I see him!"); enemyArray[i].agent.destination = target.position; } else if(!flee) enemyArray[i].agent.destination = target.position + target.forward*5; enemyArray[i].movementState = MovementState.MSearch; } seesPlayer = true; transform.rotation = Quaternion.Slerp(transform.rotation,Quaternion.LookRotation(target.position - transform.position), vRotationSpeed*Time.deltaTime); //Check to see player is within sights of the gun if (angle < firingAngle) { //Debug.Log ("AI: Got him in my sights!"); isFocusedOnPlayer = true; } else isFocusedOnPlayer = false; } else { //I no longer see the player //Debug.Log ("AI: Sorry guys, no longer got him"); seesPlayer = false; viewState = ViewState.VIdle; isFocusedOnPlayer = false; } } } yield return 0; } NextViewState (); }
protected void Page_PreRender(object sender, EventArgs e) { //Get Settings if (Request.RequestType == "POST") { } else { //The method was a GET, therfore we must be paging. _currentPage = Strings.ToInt(Request.Params["PageNum"], 1); _recordsPerPage = Strings.ToInt(Request.Params["RecordsPerPage"], 10); _offSet = Strings.ToInt(Request.Params["OffSet"], 0); } if (PerformSearch) { if (Keyword != null) { //Store keyword in viewstate (This does not check if it is not there already) if (ViewState[swKeyword] == null) { ViewState.Add(swKeyword, Keyword); } else { ViewState[swKeyword] = Keyword; } //set up the search collection //determine what text needs to be removed from the title e.g. - National Cancer Institute SiteWideSearchConfig searchConfig = ModuleObjectFactory <SiteWideSearchConfig> .GetModuleObject(SnippetInfo.Data); if (searchConfig != null) { SearchCollection = searchConfig.SearchCollection; ResultTitleText = searchConfig.ResultTitleText; } try { long dimFilter = Strings.ToLong(ConfigurationManager.AppSettings["EndecaSWSearchDimFilter"], 0); SiteWideSearchAPIResultCollection results = SiteWideSearchManager.Search(SearchCollection, Keyword, _recordsPerPage, (_currentPage - 1) * _recordsPerPage); rptSearchResults.DataSource = results.SearchResults; rptSearchResults.DataBind(); if (results.ResultCount == 0) { ResultsText = "No results found"; rptSearchResults.Visible = false; } else { int startRecord = 0; int endRecord = 0; _resultsFound = true; SimplePager.GetFirstItemLastItem(_currentPage, _recordsPerPage, (int)results.ResultCount, out startRecord, out endRecord); //phNoResultsLabel.Visible = false; rptSearchResults.Visible = true; string resultsCount = String.Format("{0}-{1} of {2}", startRecord.ToString(), endRecord.ToString(), results.ResultCount.ToString()); ResultsText = "Results " + resultsCount; } spPager.RecordCount = (int)results.ResultCount; spPager.RecordsPerPage = _recordsPerPage; spPager.CurrentPage = _currentPage; spPager.BaseUrl = PrettyUrl + "?swKeywordQuery=" + Keyword; } catch (Exception ex) { //capture exactly which keyword caused the error log.ErrorFormat("Search with the following keyword returned an error: {0}", ex, Keyword); } } else { ResultsText = "No results found"; rptSearchResults.Visible = false; } } else { ResultsText = String.Empty; } }
//Visual search state, randomly look around and check to see if we see the player IEnumerator VSearchState() { Transform target = GameObject.FindWithTag ("Player").transform; Vector3 targetPosition = target.position; while (viewState == ViewState.VSearch) { searchTimer--; //Vision Cone calculation Vector3 targetDir = target.position - transform.position; Vector3 forward = transform.forward; float angle = Vector3.Angle(targetDir, forward); //If player is within vision cone then proceed if (angle < visionAngle) { //Check to see if there are any object between player and myself RaycastHit hit; if (Physics.Raycast(transform.position, targetDir, out hit)) { if(hit.transform == target) { seesPlayer = true; viewState = ViewState.VFocus; } } } //Look in another direction if(searchTimer < 0) { searchTimer = searchTime + Random.Range (-100,100); targetPosition = new Vector3(Random.Range (-100,100),transform.position.y,Random.Range (-100,100)); } transform.rotation = Quaternion.Slerp(transform.rotation,Quaternion.LookRotation(targetPosition - transform.position), vRotationSpeed*Time.deltaTime); yield return 0; } NextViewState (); }
/// <summary> /// 展示新闻界面 /// </summary> public NewsView(string newsID, ViewState state) : this() { GoToState(state); LoadImage(newsID, state); }
private void SetcallTreeView() { foreach(Control c in controlCollection.Controls) { DiffTreeListView v = null; try { v = (DiffTreeListView)c; } catch { /* not interested in exceptions */ } if(v != null) { diffCallTreeView = v; viewState = (ViewState)v.TokenObject; return; } } Debug.Fail("Cannot find tree view on the tab page"); }
private void setImageForTabState(ImageButton btn) { string imageAttiva = ""; string imageNonAttiva = ""; typeVersoTrasm versoTrasm = getVersoTrasm(); queryStringPar_Verso = getVersoTrasmToString(versoTrasm); queryStringPar_Tab = getTabNameByButton(btn); //solo se già un butt è stato cliccato if (ViewState["ID_Butt_precedente"] != null) { //img del butt precedentemente cliccato torna a nonattivo. ImageButton btnPrec = ((ImageButton)Page.FindControl((string)ViewState["ID_Butt_precedente"])); if (btnPrec.ID == this.btn_completa.ID) { //imageNonAttiva="../images/ricerca/completa_nonattivo.gif"; imageNonAttiva = "../App_Themes/ImgComuni/completa_nonattivo.gif"; if (queryStringPar_Verso == "R") { //this.btn_toDoListAndAssPend.ImageUrl="../images/ricerca/todolist_nonattivo.gif"; this.btn_toDoList.ImageUrl = "../App_Themes/ImgComuni/todolist_nonattivo.gif"; } else { //this.btn_toDoListAndAssPend.ImageUrl="../images/ricerca/assegnazionedipendenti_nonattivo.gif"; this.btn_toDoList.ImageUrl = "../App_Themes/ImgComuni/assegnazionedipendenti_nonattivo.gif"; } } else { if (versoTrasm == typeVersoTrasm.Effettuate) { //imageNonAttiva="../images/ricerca/assegnazionedipendenti_nonattivo.gif"; imageNonAttiva = "../App_Themes/ImgComuni/assegnazionedipendenti_nonattivo.gif"; } else if (versoTrasm == typeVersoTrasm.Ricevute) { //imageNonAttiva="../images/ricerca/todolist_nonattivo.gif"; imageNonAttiva = "../App_Themes/ImgComuni/todolist_nonattivo.gif"; } } btnPrec.ImageUrl = imageNonAttiva; } else { if (versoTrasm == typeVersoTrasm.Effettuate) { //imageNonAttiva="../images/ricerca/assegnazionedipendenti_nonattivo.gif"; imageNonAttiva = "../App_Themes/ImgComuni/assegnazionedipendenti_nonattivo.gif"; } else if (versoTrasm == typeVersoTrasm.Ricevute) { //imageNonAttiva="../images/ricerca/todolist_nonattivo.gif"; imageNonAttiva = "../App_Themes/ImgComuni/todolist_nonattivo.gif"; } this.btn_toDoList.ImageUrl = imageNonAttiva; //this.btn_completa.ImageUrl=this.btn_completa.ImageUrl.Substring(0, this.btn_completa.ImageUrl.IndexOf("_"))+"_nonattivo.gif"; this.btn_completa.ImageUrl = this.btn_completa.ID.Substring(this.btn_completa.ImageUrl.IndexOf("_") + 1) + "_nonattivo.gif"; } //serve per segnare la prima volta che si click un bottone. if (Page.IsPostBack) { ViewState.Add("ID_Butt_precedente", btn.ID); } //cambio img del butt cliccato //imageAttiva=btn.ImageUrl.Substring(0, btn.ImageUrl.IndexOf("_"))+"_attivo.gif"; imageAttiva = "../App_Themes/" + this.Tema + "/" + btn.ID.Substring(btn.ID.IndexOf("_") + 1) + "_attivo.gif"; btn.ImageUrl = imageAttiva; }