internal void OnSourcePropertyChanged(object o, string propName) { int level; // ignore changes that don't affect this binding. // This test must come before any marshalling to the right context (bug 892484) if (!IgnoreSourcePropertyChange && (level = PW.LevelForPropertyChange(o, propName)) >= 0) { // if notification was on the right thread, just do the work (normal case) if (Dispatcher.Thread == Thread.CurrentThread) { PW.OnPropertyChangedAtLevel(level); } else { // otherwise invoke an operation to do the work on the right context SetTransferIsPending(true); if (ParentBindingExpression.TargetWantsCrossThreadNotifications) { LiveShapingItem lsi = TargetElement as LiveShapingItem; if (lsi != null) { lsi.OnCrossThreadPropertyChange(TargetProperty); } } Engine.Marshal( new DispatcherOperationCallback(ScheduleTransferOperation), null); } } }
public Library SignIn([FromBody] SignInArgs args) { using (var db = new favlEntities()) { var librarian = db.Librarians.FirstOrDefault(l => l.Username == args.username); if (librarian == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } if (!PW.Verify(args.password, librarian.PasswordHash, librarian.PasswordSalt)) { throw new HttpResponseException(HttpStatusCode.Unauthorized); } return(new Library { Id = librarian.Library.Id, Name = librarian.Library.Name, Village = librarian.Library.Village, Country = librarian.Library.Country }); } }
internal override void DetachDataItem() { PW.DetachFromRootItem(); if (XmlWorker != null) { XmlWorker.DetachDataItem(); } // cancel any pending async requests. If it has already completed, // but is now waiting in the dispatcher queue, it will be ignored because // we set _pending*Request to null. AsyncGetValueRequest pendingGetValueRequest = (AsyncGetValueRequest)GetValue(Feature.PendingGetValueRequest, null); if (pendingGetValueRequest != null) { pendingGetValueRequest.Cancel(); ClearValue(Feature.PendingGetValueRequest); } AsyncSetValueRequest pendingSetValueRequest = (AsyncSetValueRequest)GetValue(Feature.PendingSetValueRequest, null); if (pendingSetValueRequest != null) { pendingSetValueRequest.Cancel(); ClearValue(Feature.PendingSetValueRequest); } }
private void BtnSave_Click(object sender, RoutedEventArgs e) { if (PW.Access(1) && Utl.YesNo("Сохранить протокол?")) { ViewProtocolController.SaveProtocol(); } }
void CompleteGetValue(AsyncGetValueRequest request) { AsyncGetValueRequest pendingGetValueRequest = (AsyncGetValueRequest)GetValue(Feature.PendingGetValueRequest, null); if (pendingGetValueRequest == request) { ClearValue(Feature.PendingGetValueRequest); int k = (int)request.Args[1]; switch (request.Status) { case AsyncRequestStatus.Completed: PW.OnNewValue(k, request.Result); SetStatus(PW.Status); if (k == PW.Length - 1) { ParentBindingExpression.TransferValue(request.Result, false); } break; case AsyncRequestStatus.Failed: ReportGetValueError(k, request.SourceItem, request.Exception); PW.OnNewValue(k, DependencyProperty.UnsetValue); break; } } }
public int RozpocznijDekompletacje() { NowyDokument(RW); WartoscRW = RW.WartoscDokumentu; ZwracaneWyniki = RW.GetReturns(); List <int> _ZwracaneWyniki = new List <int>(); _ZwracaneWyniki.AddRange(ZwracaneWyniki); if (SprawdzPoprawnoscDokumentu()) { NowyDokument(PW); _ZwracaneWyniki.AddRange(PW.GetReturns()); return(_ZwracaneWyniki.Sum()); } else { info.Sukces = false; info.Komunikat = "Różnica wartości dokumentów RW / PW jest zbyt duża.Wszystkie dokumenty dekompletacji zostaną cofnięte."; info.Rodzic = true; RW.NotifyObservers(info); AnulujDekompletacje(); _ZwracaneWyniki.AddRange(ZwracaneWyniki); return(_ZwracaneWyniki.Sum()); } }
private void btnClick(object sender, RoutedEventArgs e) { Button btn = sender as Button; switch (btn.Name) { case "btnBack": ((MainWindow)App.Current.MainWindow).btn_BackMenu(); break; case "btnDel": if (SavedListBox.SelectedItems.Count != 0) { if (PW.Access(1)) { if (Utl.YesNo("Удалить выбранные?")) { spm.DeleteMarked(SavedListBox.SelectedItems); } } SavedListBox.SelectedIndex = -1; } break; case "btnMarkAll": if (!markedAll) { SavedListBox.SelectAll(); markedAll = true; btnMarkAll.Content = "снять выделение"; } else { SavedListBox.UnselectAll(); markedAll = false; btnMarkAll.Content = "выделить всё"; } break; case "btnOpen": if (SavedListBox.SelectedItems.Count != 0) { if (SavedListBox.SelectedItems.Count == 1) { ViewProtocolController vpc = new ViewProtocolController( ((SavedProtocolsManager.SavedElement)SavedListBox.SelectedItems[0]).ProtocolPath); vpc.ShowProtocolPage(); SavedListBox.SelectedIndex = -1; } else { Utl.Message("Для просмотра выберите только один протокол"); } } break; } }
// called by the child XmlBindingWorker when an xml change is detected // but the identity of raw value has not changed. internal void OnXmlValueChanged() { // treat this as a property change at the top level object item = PW.GetItem(0); OnSourcePropertyChanged(item, null); }
internal override void OnCurrentChanged(ICollectionView collectionView, EventArgs args) { if (XmlWorker != null) { XmlWorker.OnCurrentChanged(collectionView, args); } PW.OnCurrentChanged(collectionView); }
internal override object RawValue() { object rawValue = PW.RawValue(); SetStatus(PW.Status); return(rawValue); }
// GET: Park public ActionResult Detail(string id) { Park p = dal.GetPark(id); List <Weather> w = dal.GetWeather(id); PW pw = new PW(p, w); return(View("Detail", pw)); }
public void SavePW(PW przychodwewnetrzny) { if (przychodwewnetrzny.PWID == 0) { context.PWs.Add(przychodwewnetrzny); context.SaveChanges(); } }
// called by the child XmlBindingWorker when there's a new raw value internal void UseNewXmlItem(object item) { PW.DetachFromRootItem(); PW.AttachToRootItem(item); if (Status != BindingStatusInternal.AsyncRequestPending) { ParentBindingExpression.ScheduleTransfer(false); } }
private void PW_Enter(object sender, EventArgs e) { if ((PW.Text != "" && PW.Text != "Password")) { PW.UseSystemPasswordChar = true; PW.Clear(); PW.ForeColor = Color.Black; } }
protected void Page_Load(object sender, EventArgs e) { usernameError.Visible = false; passwordError.Visible = false; if (!IsPostBack) { return; } var username = Request.Form["Username"]?.Trim(); var password = Request.Form["Password"]?.Trim(); if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { return; } if (username.ToLower() == "admin" && password == "FAVLScan2017") { var adminCookie = new HttpCookie("Admin") { ["ID"] = PW.AdminCookie(PW.GOD_USER_ID), Expires = DateTime.Now.AddDays(1) }; Response.Cookies.Add(adminCookie); Response.Redirect("/admin/"); } using (var db = new favlEntities()) { var admin = db.Admins.FirstOrDefault(l => l.Username == username); if (admin == null) { usernameError.Visible = true; return; } if (!PW.Verify(password, admin.PasswordHash, admin.PasswordSalt)) { passwordError.Visible = true; return; } var adminCookie = new HttpCookie("Admin") { ["ID"] = PW.AdminCookie(admin.Id), Expires = DateTime.Now.AddDays(1) }; Response.Cookies.Add(adminCookie); Response.Redirect("/admin/"); } }
private void PW_Click_1(object sender, EventArgs e) { if (PW.Text == "Password") { PW.Clear(); PW.ForeColor = Color.Black; } // if (PW.Text == "Password") //PW.UseSystemPasswordChar = false; //else PW.UseSystemPasswordChar = true; }
private TextEditorBase GetTextEditorByExtension(string FileName) { // We cache the list, so create only once if (TextEditors.Count() == 0) { var list = from type in typeof(TextEditorBase).Assembly.GetTypes() where type.IsSubclassOf(typeof(TextEditorBase)) select type; foreach (Type t in list) { if (t != typeof(PlugInTextEditorWrapper)) { TextEditorBase TE = (TextEditorBase)Activator.CreateInstance(t); TextEditors.Add(TE); } } } // Add all plugins TextEditors ObservableList <PlugInWrapper> PlugInsList = App.LocalRepository.GetSolutionPlugIns(); foreach (PlugInWrapper PW in PlugInsList) { foreach (PlugInTextFileEditorBase TE in PW.TextEditors()) { PlugInTextEditorWrapper w = new PlugInTextEditorWrapper(TE); PlugInTextEditorWrapper f = (PlugInTextEditorWrapper)TextEditors.Where(x => x is PlugInTextEditorWrapper ? ((PlugInTextEditorWrapper)x).GetEditorID() == w.GetEditorID() : false).FirstOrDefault(); if (f == null) { TextEditors.Add(w); } } } //TODO: if there is more than one let the user pick string ext = Path.GetExtension(FileName).ToLower(); foreach (TextEditorBase TE in TextEditors) { if (TE.Extensions != null) { if (TE.Extensions.Contains(ext)) { return(TE); } } } return(null); }
private void AnulujDekompletacje() { if (PW.StanDokumentu != -1 && PW.DokumentNumer != 0) { PW.AnulujDokument(); ZwracaneWyniki = PW.GetReturns(); RW.AnulujDokument(); } else if (RW.StanDokumentu == -1 && RW.DokumentNumer != 0) { RW.AnulujDokument(); } }
public override int GetHashCode() { unchecked { int result = base.GetHashCode(); result = (result * 397) ^ (W != null ? W.GetHashCode() : 0); result = (result * 397) ^ (PW != null ? PW.GetHashCode() : 0); result = (result * 397) ^ (DW != null ? DW.GetHashCode() : 0); result = (result * 397) ^ ReturnBody.GetHashCode(); result = (result * 397) ^ Context.GetHashCode(); result = (result * 397) ^ IncludeContext.GetHashCode(); return(result); } }
internal void ReportGetValueError(int k, object item, Exception ex) { if (TraceData.IsEnabled) { SourceValueInfo svi = PW.GetSourceValueInfo(k); Type type = PW.GetType(k); string parentName = (k > 0)? PW.GetSourceValueInfo(k - 1).name : String.Empty; TraceData.Trace(ParentBindingExpression.TraceLevel, TraceData.CannotGetClrRawValue( svi.propertyName, type.Name, parentName, AvTrace.TypeName(item)), ParentBindingExpression, ex); } }
internal void ReportSetValueError(int k, object item, object value, Exception ex) { if (TraceData.IsEnabled) { SourceValueInfo svi = PW.GetSourceValueInfo(k); Type type = PW.GetType(k); TraceData.Trace(TraceEventType.Error, TraceData.CannotSetClrRawValue( svi.propertyName, type.Name, AvTrace.TypeName(item), AvTrace.ToStringHelper(value), AvTrace.TypeName(value)), ParentBindingExpression, ex); } }
public Initial() { InitializeComponent(); ReadFile(); string[] Id = { }, na = { }, Ic = { }, Pw = { }, money = { }; Id = ID.ToArray(); na = name.ToArray(); Ic = IDcard.ToArray(); Pw = PW.ToArray(); money = Money.ToArray(); for (int i = 0; i < Id.Length; i++) { Account account = new Account(Id[i], int.Parse(Pw[i]), na[i], Ic[i]); account.money = int.Parse(money[i]); accounts.Add(account); } }
void ReplaceDependencySources() { if (!ParentBindingExpression.IsDetaching) { int size = PW.Length; if (PW.NeedsDirectNotification) { ++size; } WeakDependencySource[] newSources = new WeakDependencySource[size]; int n = 0; if (IsDynamic) { for (int k = 0; k < PW.Length; ++k) { DependencyProperty dp = PW.GetAccessor(k) as DependencyProperty; if (dp != null) { DependencyObject d = PW.GetItem(k) as DependencyObject; if (d != null) { newSources[n++] = new WeakDependencySource(d, dp); } } } if (PW.NeedsDirectNotification) { // subproperty notifications can only arise from Freezables // (as of today - 11/14/08), so we only need to propagate // them when the raw value is a Freezable. DependencyObject d = PW.RawValue() as Freezable; if (d != null) { newSources[n++] = new WeakDependencySource(d, DependencyObject.DirectDependencyProperty); } } } ParentBindingExpression.ChangeWorkerSources(newSources, n); } }
internal override void UpdateValue(object value) { int k = PW.Length - 1; object item = PW.GetItem(k); if (item == null || item == BindingExpression.NullDataItem) { return; } // if the binding is async, post a request to set the value if (ParentBinding.IsAsync && !(PW.GetAccessor(k) is DependencyProperty)) { RequestAsyncSetValue(item, value); return; } PW.SetValue(item, value); }
public void ReadFile() { StreamReader ac = new StreamReader(@"\0.txt", Encoding.Default); string content = ac.ReadToEnd(); string[] lines = content.Split('\n'); for (int i = 0; i < lines.Length; i++) { string[] words = lines[i].Trim().Split('\t'); if (words.Length < 5) { continue; } ID.Add(words[0]); PW.Add(words[1]); name.Add(words[2]); IDcard.Add(words[3]); Money.Add(words[4]); } }
private void Print_Click(object sender, RoutedEventArgs e) { if (PW.Access(1) && Utl.YesNo("Печатать?")) { switch (EngineerMenu.PC.PrintWaySlType.V) { case 0: ViewProtocolController.Print(); break; case 1: ViewProtocolController.PrintPdf(); break; default: ViewProtocolController.PrintPdf(); break; } } }
internal override void AttachDataItem() { object item; if (XmlWorker == null) { item = DataItem; } else { XmlWorker.AttachDataItem(); item = XmlWorker.RawValue(); } PW.AttachToRootItem(item); if (PW.Length == 0) { ParentBindingExpression.SetupDefaultValueConverter(item.GetType()); } }
public void saveWordPairsFromList(string fileName, string profile, listManager LM) { if (profile != null && (profile.Length > 0 && fileName.Length > 0)) { if (doesFileExist(fileName, profile)) { string filePath = this.folderLocation + profile + "/" + fileName; foreach (pairWords PW in LM.getList()) { this.addToContent(PW.getPairTogetherString()); } File.WriteAllLines(@filePath, this.fileContents.ToArray()); } else { MessageBox.Show("File doesn't exists. Try to recreate file list."); } } else { MessageBox.Show("Invalid profile name or file name."); } }
public override string ToString() { string Powers = ""; if (PickedUpPowers != null) { foreach (Power PW in PickedUpPowers) { Powers += PW.GetPowerTag() + "\t"; } } else { Powers = "None"; } return("Health: " + this.GetHealth() + "\nMaxHealth: " + this.GetMaxHealth() + "\nMana: " + this.GetMana() + "\nMaxMana: " + this.GetMaxMana() + "\nLevel: " + this.GetLevel() + "\nPowers:" + Powers); }
void RequestAsyncSetValue(object item, object value) { // get information about the property whose value we want string name = GetNameFromInfo(PW.GetAccessor(PW.Length - 1)); Invariant.Assert(name != null, "Async SetValue expects a name"); // abandon any previous request AsyncSetValueRequest pendingSetValueRequest = (AsyncSetValueRequest)GetValue(Feature.PendingSetValueRequest, null); if (pendingSetValueRequest != null) { pendingSetValueRequest.Cancel(); } // issue the new request pendingSetValueRequest = new AsyncSetValueRequest(item, name, value, ParentBinding.AsyncState, DoSetValueCallback, CompleteSetValueCallback, this); SetValue(Feature.PendingSetValueRequest, pendingSetValueRequest); Engine.AddAsyncRequest(TargetElement, pendingSetValueRequest); }
public static extern bool PrintWindow(HWND hwnd, IntPtr hdcBlt, PW nFlags);