public static List <NotifyList> ViewNotifs(int logID) { Database db = new Database(); Login log = new Login(); Notification not = new Notification(); string role = Data.roles(logID); List <NotifyList> notify = new List <NotifyList>(); int dept = db.Logins.Where(i => i.LoginId == logID).Select(i => i.DID).FirstOrDefault(); var NotifyList = db.Notifications.Where(i => (i.Roles == "All" && i.Roles != role)).OrderBy(i => i.Date); if (role == "Teacher" || role == "Student") { NotifyList = db.Notifications.Where(i => (i.Roles == "All" && db.Logins.Where(j => j.LoginId == i.FromUserID).Select(j => j.RoleId).FirstOrDefault() == 3) || ((i.Roles == "All" || i.Roles == role) && (db.Logins.Where(j => j.LoginId == i.FromUserID).Select(j => j.RoleId).FirstOrDefault() == 4) && (dept == db.Logins.Where(j => j.LoginId == i.FromUserID).Select(j => j.DID).FirstOrDefault()))).OrderBy(i => i.Date); } foreach (var i in NotifyList) { NotifyList stud = new NotifyList(); stud.FromUser = db.Logins.Where(j => j.LoginId == i.FromUserID).Select(j => j.UserName).FirstOrDefault(); stud.RoleName = db.Roles.Where(k => k.RoleId == (db.Logins.Where(j => j.LoginId == i.FromUserID).Select(j => j.RoleId).FirstOrDefault())).Select(k => k.RoleName).FirstOrDefault();; stud.Date_Time = i.Date; stud.Content = i.Content; notify.Add(stud); } return(notify); }
private void rebind() { if (IsLatched) { return; } _metaDataDTOList = new NotifyList <MetaDataDTO>(); _allDataRepositories.ToList().IntersectingMetaData().Each(x => _metaDataDTOList.Add(createDTO(x))); _view.BindToMetaData(_metaDataDTOList); _view.MolWeightEditable = _observedDataConfiguration.MolWeightAlwaysEditable || !_allDataRepositories.Any(x => x.ExtendedProperties.Contains(Captions.Molecule)); var molWeightParameter = retrieveUniqueMolWeightParameter(); var shouldBindToMolWeight = molWeightParameter != null && _observedDataConfiguration.MolWeightVisible; _view.MolWeightVisible = shouldBindToMolWeight; if (shouldBindToMolWeight) { _view.BindToMolWeight(molWeightParameter); } var lowerLimitsOfQuantification = retrieveLLOQs().ToList(); if (lowerLimitsOfQuantification.Count == 1) { _view.BindToLLOQ(lowerLimitsOfQuantification.First()); } }
protected JournalPresenter( IJournalView view, IRegionResolver regionResolver, IJournalPageToJournalPageDTOMapper mapper, IJournalTask journalTask, IViewItemContextMenuFactory viewItemContextMenuFactory, IJournalRetriever journalRetriever, IJournalPagePreviewPresenter previewPresenter, IJournalSearchPresenter searchPresenter, RegionName regionName) : base(view) { _mapper = mapper; _journalTask = journalTask; _viewItemContextMenuFactory = viewItemContextMenuFactory; _journalRetriever = journalRetriever; _previewPresenter = previewPresenter; _searchPresenter = searchPresenter; _region = regionResolver.RegionWithName(regionName); _allJournalPageDTOs = new NotifyList <JournalPageDTO>(); View.AddPreviewView(_previewPresenter.BaseView); View.AddSeachView(_searchPresenter.BaseView); AddSubPresenters(_previewPresenter, _searchPresenter); View.BindTo(_allJournalPageDTOs); View.SearchVisible = false; _journalSearch = null; _region.Add(View); }
public Product() { // Initialize the unique pad to ensure it's always there _uniquePad = Guid.NewGuid().ToString(); _features = new NotifyList<Feature>(); }
public void ClearNotifications(MessageOrigin messageOrigin) { var newNotifications = new NotifyList <NotificationMessageDTO>(_allNotifications); _allNotifications.Where(n => n.MessageOrigin.Is(messageOrigin)).Each(n => newNotifications.Remove(n)); _allNotifications = newNotifications; bindToView(); }
public override void Initialize() { _region = _regionResolver.RegionWithName(RegionNames.NotificationList); _region.Add(_view); new[] { NotificationType.Error, NotificationType.Info, NotificationType.Warning }.Each(t => _view.Show(t, isShowing(t))); _allNotifications = new NotifyList <NotificationMessageDTO>(); bindToView(); }
public override void EditProtocol(Protocol protocol) { _protocol = protocol.DowncastTo <AdvancedProtocol>(); _allSchemas = new NotifyList <SchemaDTO>(_protocol.AllSchemas.MapAllUsing(_schemaDTOMapper).ToList()); _view.BindToProperties(_protocol); _view.BindToSchemas(_allSchemas); }
/// <summary> /// Hooks up an observable collection with code that creates child pages for that collection's contents. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="createPageSummaryForChild"></param> internal void AssociateListWithChildPages <T>(NotifyList <T> list, Func <PageSummary> createPageSummaryForChild) { _ChildPageSummariesList = list; _CreateChildPageSummaryDelegate = createPageSummaryForChild; _ChildPageSummariesList.ListChanged += ChildPagesList_ListChanged; SynchroniseListToChildPages(); }
protected override void Context() { sut = new NotifyList <IAnInterface>(); _implementation0 = new AnImplementation { FirstName = "aaa" }; sut.Add(_implementation0); _reference = new WeakReference(_implementation0); }
public void TestInitialise() { _IntList = new NotifyList <int>(); _ObservableList = new NotifyList <ObservableClass>(); _ListChanged = new EventRecorder <ListChangedEventArgs>(); _CollectionChanged = new EventRecorder <NotifyCollectionChangedEventArgs>(); _ObservableValueDescriptor = TypeDescriptor.GetProperties(typeof(ObservableClass))[nameof(ObservableClass.Value)]; }
public ParameterIdentificationOutputMappingPresenter(IParameterIdentificationOutputMappingView view, IEntitiesInSimulationRetriever entitiesInSimulationRetriever, IObservedDataRepository observedDataRepository, IOutputMappingToOutputMappingDTOMapper outputMappingDTOMapper, IQuantityToSimulationQuantitySelectionDTOMapper simulationQuantitySelectionDTOMapper, IParameterIdentificationTask parameterIdentificationTask) : base(view) { _entitiesInSimulationRetriever = entitiesInSimulationRetriever; _observedDataRepository = observedDataRepository; _outputMappingDTOMapper = outputMappingDTOMapper; _simulationQuantitySelectionDTOMapper = simulationQuantitySelectionDTOMapper; _parameterIdentificationTask = parameterIdentificationTask; _allOutputMappingDTOs = new NotifyList <OutputMappingDTO>(); }
public BinSizeGroupingDTO() { NumberOfBins = 3; NamingPattern = LabelGenerationOptions.DEFAULT_NAMING_PATTERN; Labels = new NotifyList <GroupingItemDTO>(); Strategy = LabelGenerationStrategies.Numeric; Symbol = Symbols.Circle; StartColor = PKSimColors.StartGroupingColor; EndColor = PKSimColors.EndGroupingColor; Rules.AddRange(new[] { atLeastTwoBins, maximumOfBins }); }
public void Start() { initAppwarp (); connListener = new ConnectionListener (); roomListener = new RoomListener (); notify = new NotifyList (); zoneListen = new ZoneListen (); WarpClient.GetInstance ().AddConnectionRequestListener (connListener); WarpClient.GetInstance ().AddRoomRequestListener (roomListener); WarpClient.GetInstance ().AddNotificationListener (notify); WarpClient.GetInstance ().AddZoneRequestListener (zoneListen); }
public void NotifyListSerializationTest() { NotifyList <NotifyTestItem> list = new NotifyList <NotifyTestItem>(); list.Add(new NotifyTestItem("Test1")); list.Add(new NotifyTestItem("Test2")); var deserializedList = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(list)); Assert.AreEqual("Test1", list[0].Value); Assert.AreEqual("Test2", list[1].Value); }
public SimulationCompoundsSelectionPresenter(ISimulationCompoundsSelectionView view, IBuildingBlockRepository buildingBlockRepository, IBuildingBlockInSimulationManager buildingBlockInSimulationManager, ICompoundTask compoundTask, IBuildingBlockSelectionDisplayer buildingBlockSelectionDisplayer) : base(view) { _buildingBlockRepository = buildingBlockRepository; _buildingBlockInSimulationManager = buildingBlockInSimulationManager; _compoundTask = compoundTask; _buildingBlockSelectionDisplayer = buildingBlockSelectionDisplayer; _compoundSelectionDTOs = new NotifyList <CompoundSelectionDTO>(); _view.BindTo(_compoundSelectionDTOs); _compoundSelectionDTOs.CollectionChanged += onCollectionChanged; }
public static void CloseNotify(int id, Form form) { var notify = NotifyList.SingleOrDefault(p => p.UID == id); if (notify == null) { return; } if (notify.State == (int)BillState.Finished) { return; } using (SpareEntities db = EntitiesFactory.CreateSpareInstance()) { try { NotifyController.CloseNotify(db, GlobalVar.Oper.OperName, notify); EntitiesFactory.SaveDb(db); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } } NotifyType notifyType = (NotifyType)notify.NotifyType; var formMain = (FormMain)form; if (formMain == null) { return; } /* switch (notifyType) * { * case NotifyType.Ask: * formMain.SetMdiForm("仓库申请单", typeof(FormWhseAskView)); * break; * case NotifyType.Stock: * formMain.SetMdiForm("仓库库存", typeof(FormStockProduct)); * break; * case NotifyType.TransferSend: * formMain.SetMdiForm("中转发运单", typeof(FormFactoryTransferSend)); * break; * case NotifyType.DirectSend: * formMain.SetMdiForm("直送发运单", typeof(FormFactoryDirectSend)); * break; * case NotifyType.WhseSend: * formMain.SetMdiForm("仓库发运单", typeof(FormWhseSend)); * break; * }*/ }
static Publish() { //_commitLock.ID = -1; _onConsume = new NotifyList<Action> // handled on-demand { OnNotify = () => { // impossible for Consume lock to not be available, since _onConsume gets paused while Publish lock is held Debug.Assert(!_publishLock.IsWriteLockHeld); using (Transaction()) _onConsume.Get().ForEach(); }, }; }
private void updateNotificationWith(IEnumerable <NotificationMessageDTO> notificationMessages) { _allNotifications = new NotifyList <NotificationMessageDTO>(_allNotifications); notificationMessages.Where(notificationIsVisible).Each(m => { if (!_allNotifications.Contains(m)) { _allNotifications.Add(m); } }); bindToView(); }
async Task <NotifyList> Load() { NotifyList list = null; try { var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(NotifyName, CreationCollisionOption.OpenIfExists); var json = await FileIO.ReadTextAsync(file); list = JsonConvert.DeserializeObject <NotifyList>(json); } catch { } return(list); }
#pragma warning restore 0067 public DialogResult ShowView() { _ViewModel = new ViewModel(); _ValidationHelper = new ValidationModelHelper(_ViewModel.FindViewModelForRecord); Users = new NotifyList <IUser>(); _Presenter = Factory.Resolve <ISettingsPresenter>(); _Presenter.Initialise(this); _ViewModel.Configuration.RefreshFromConfiguration(Configuration, Users); _Presenter.ValidateView(); _ViewModel.ComPortNames = _Presenter.GetSerialPortNames().ToArray(); _ViewModel.VoiceNames = _Presenter.GetVoiceNames().ToArray(); return(DialogResult.OK); }
protected override void Context() { _compoundTask = A.Fake <ICompoundTask>(); _view = A.Fake <ISimulationCompoundsSelectionView>(); _buildingBlockRepository = A.Fake <IBuildingBlockRepository>(); _buildingBlockInSimulationManager = A.Fake <IBuildingBlockInSimulationManager>(); _buildingBlockSelectionDisplayer = A.Fake <IBuildingBlockSelectionDisplayer>(); A.CallTo(() => _buildingBlockRepository.All <Compound>()).Returns(_allCompoundTemplates); A.CallTo(() => _view.BindTo(A <NotifyList <CompoundSelectionDTO> > ._)) .Invokes(x => _compoundDTOList = x.GetArgument <NotifyList <CompoundSelectionDTO> >(0)); sut = new SimulationCompoundsSelectionPresenter(_view, _buildingBlockRepository, _buildingBlockInSimulationManager, _compoundTask, _buildingBlockSelectionDisplayer); sut.Initialize(); CompoundSelectionDTOFor(_compound1).Selected = true; }
/// <summary> /// Unhooks a hooked list and all of its contents. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="hookedRecords"></param> /// <param name="recordEventHandler"></param> /// <param name="listEventHandler"></param> /// <param name="unhookChild"></param> private void UnhookList <T>(NotifyList <T> list, List <T> hookedRecords, PropertyChangedEventHandler recordEventHandler, ListChangedEventHandler listEventHandler, Action <T> unhookChild = null) where T : INotifyPropertyChanged { if (_HookedLists.Contains(list)) { foreach (var record in hookedRecords) { record.PropertyChanged -= recordEventHandler; if (unhookChild != null) { unhookChild(record); } } hookedRecords.Clear(); list.ListChanged -= listEventHandler; _HookedLists.Remove(list); } }
public void GetList() { string portNumber = ConfigurationManager.AppSettings["PortNum"]; string ipNumber = ConfigurationManager.AppSettings["ip"]; IPEndPoint ep = new IPEndPoint(IPAddress.Parse(portNumber), int.Parse(ipNumber)); TcpClient client = new TcpClient(); client.Connect(ep); NetworkStream stream = client.GetStream(); BinaryReader reader = new BinaryReader(stream); BinaryWriter writer = new BinaryWriter(stream); writer.Write("list"); string s = reader.ReadString(); //todo convert s tolist NotifyList?.Invoke(); }
public void Add <T>(T temp) where T : class { if (temp is Person) { Person a = temp as Person; person.Add(a); NotifyList?.Invoke("add Person", a.Name); } else if (temp is Trafic) { Trafic a = temp as Trafic; res.Add(a.NameTr, a); NotifyList?.Invoke("add Trafic", a.NameTr); } else { throw new InvalidCastException(); } }
/// <summary> /// Hooks an observable list on the configuration. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="hookedRecords"></param> /// <param name="recordEventHandler"></param> /// <param name="listEventHandler"></param> /// <param name="hookChild"></param> /// <param name="unhookChild"></param> private void HookList <T>(NotifyList <T> list, List <T> hookedRecords, PropertyChangedEventHandler recordEventHandler, ListChangedEventHandler listEventHandler, Action <T> hookChild = null, Action <T> unhookChild = null) where T : INotifyPropertyChanged { if (_HookedLists.Contains(list)) { UnhookList(list, hookedRecords, recordEventHandler, listEventHandler, unhookChild); } foreach (var record in list) { hookedRecords.Add(record); record.PropertyChanged += recordEventHandler; if (hookChild != null) { hookChild(record); } } list.ListChanged += listEventHandler; _HookedLists.Add(list); }
/// <summary> /// 检查用户并保持会话 /// </summary> private void CheckUser() { string errmsg = ""; ResultInfo outjson = new ResultInfo(); if (Session["userinfo"] != null) { UserInfo userinfo = new UserInfo(); userinfo = (UserInfo)Session["userinfo"]; outjson.errcode = 0; string unnotify = ""; BLLUserManage mybll = new BLLUserManage(); bool result = mybll.GetUserUnNotifyV2(userinfo.usercode, ref unnotify, ref errmsg); NotifyList info_notify = ObjectSeriallizeHelper.JsonToObject <NotifyList>(unnotify); outjson.notify = ObjectSeriallizeHelper.ObjectToJson(info_notify.data); string tasknotify = ""; result = mybll.GetUserTaskNotifyV2(userinfo.usercode, ref tasknotify, ref errmsg); TaskNotifyList info_task = ObjectSeriallizeHelper.JsonToObject <TaskNotifyList>(tasknotify); outjson.tasknotify = ObjectSeriallizeHelper.ObjectToJson(info_task.data); string mytaskunfinished = ""; result = mybll.GetMyTaskUnfinishedListV2(userinfo.usercode, ref mytaskunfinished, ref errmsg); MyTaskList info_mytask = ObjectSeriallizeHelper.JsonToObject <MyTaskList>(mytaskunfinished); outjson.mytaskunfinished = ObjectSeriallizeHelper.ObjectToJson(info_mytask.data); string myacceptnotify = ""; result = mybll.GetMyAcceptTaskListV2(userinfo.usercode, ref myacceptnotify, ref errmsg); MyAcceptTaskList info_myaccepttask = ObjectSeriallizeHelper.JsonToObject <MyAcceptTaskList>(myacceptnotify); outjson.myaccepttask = ObjectSeriallizeHelper.ObjectToJson(info_myaccepttask.data); } else { outjson.errcode = -1; outjson.errmsg = "未登录"; } Response.Write(ObjectSeriallizeHelper.ObjectToJson(outjson)); Response.End(); }
protected override void Context() { sut = new NotifyList <IAnInterface>(); _implementation0 = new AnImplementation { FirstName = "aaa" }; _implementation1 = new AnImplementation { FirstName = "toto" }; _implementation2 = new AnImplementation { FirstName = "tata" }; sut.Add(_implementation0); sut.Add(_implementation1); sut.Add(_implementation2); sut.CollectionChanged += (o, e) => { _eventWasRaised = true; _action = e.Action; _changeEventArgs = e; }; }
protected internal override void Reset() { foreach (var folder in Folders) { folder.ResetPasswords(); } fields = null; folders = null; OnPropertyChanged("Fields"); OnPropertyChanged("Folders"); OnPropertyChanged("Name"); OnPropertyChanged("IsFavorite"); OnPropertyChanged("PasswordFolders"); base.Reset(); }
/// <summary> /// Clears all fields from this password. /// </summary> private void ClearFields() { if (fields != null) { foreach (Field field in fields) { field.Dispose(); } fields.Clear(); fields = null; } }
public Table() { Columns = new NotifyList<Column>(); Columns.ItemPropertyChanged += Columns_ItemPropertyChanged; HandlerType = TableHandlerTypes.None; }
public Database() { _tables = new NotifyList <Table>(); }
public async void Run(IBackgroundTaskInstance taskInstance) { deferral_ = taskInstance.GetDeferral(); Debug.WriteLine("NotifyTask started"); try { var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("UserSession.dat", CreationCollisionOption.OpenIfExists); var r = await FileIO.ReadTextAsync(file); if (string.IsNullOrEmpty(r)) { return; } if (r.Length < 100) { return; } string User = "******"; string Pass = "******"; InstaApi = InstaApiBuilder.CreateBuilder() .SetUser(new UserSessionData { UserName = User, Password = Pass }) .UseLogger(new DebugLogger(LogLevel.Exceptions)) .Build(); InstaApi.LoadStateDataFromStream(r); if (!InstaApi.IsUserAuthenticated) { await InstaApi.LoginAsync(); } if (!InstaApi.IsUserAuthenticated) { return; } var activities = await InstaApi.GetRecentActivityAsync(PaginationParameters.MaxPagesToLoad(1)); Notifies = await Load(); if (Notifies == null) { Notifies = new NotifyList(); } if (activities.Succeeded) { const int MAX = 9; int ix = 0; foreach (var item in activities.Value.Items) { var text = item.Text; if (item.Text.Contains(" ")) { text = text.Substring(text.IndexOf(" ") + 1); text = text.TrimStart(); } if (!Notifies.IsExists(text)) { try { var n = new NotifyClass { IsShowing = false, ProfileId = item.ProfileId, ProfilePicture = item.ProfileImage, Text = text, TimeStamp = item.TimeStamp.ToString(), Type = item.Type, }; if (item.InlineFollow == null) { var user = await InstaApi.GetUserInfoByIdAsync(item.ProfileId); if (user.Succeeded) { n.Username = user.Value.Username; } } else { n.Username = item.InlineFollow.User.UserName; n.IsFollowingYou = item.InlineFollow.IsFollowing; } Notifies.Add(n); } catch { } } ix++; if (ix > MAX) { break; } } var list = Notifies; list.Reverse(); for (int i = 0; i < list.Count; i++) { var item = list[i]; if (!string.IsNullOrEmpty(item.Username)) { if (!item.IsShowing) { NotifyHelper.CreateNotifyAction($"@{item.Username}", item.Text, item.ProfilePicture); Notifies[i].IsShowing = true; } } } } } catch (Exception ex) { Debug.WriteLine("Notify ex: " + ex.Message); Debug.WriteLine("Source: " + ex.Source); Debug.WriteLine("StackTrace: " + ex.StackTrace); } await Save(); await Task.Delay(1000); deferral_.Complete(); }
/// <summary> /// Undoing a template is very easy: /// Since there are only the TemplateFields affected, the Fields list must only be recreated to gather them from Database again. /// </summary> public void UndoTemplate() { fields = null; RaisePropertyChanged("Fields"); IsModified = false; }
/// <summary> /// Resets the list of <see cref="T:Password"/>s. /// </summary> public void ResetPasswords() { passwords = null; OnPropertyChanged("Passwords"); }
/// <summary> /// Creates a new object. /// </summary> public PageSummary() { ChildPages = new NotifyList <PageSummary>(); }
public ValueMappingGroupingPresenter(IValueMappingGroupingView view, IColorGenerator colorGenerator, ISymbolGenerator symbolGenerator) : base(view) { _colorGenerator = colorGenerator; _symbolGenerator = symbolGenerator; _mapping = new NotifyList <GroupingLabelDTO>(); }
public LicenseSet() { _uniquePad = Guid.NewGuid(); _features = new NotifyList<Feature>(); }
public Database() { _tables = new NotifyList<Table>(); }
protected LicenseBase() { _trailNotificationSettings = new TrailNotificationSettings(); _licenseSets = new NotifyList<LicenseSet>(); }
private void EnsurePasswords() { if (passwords == null) { passwords = Id != 0 ? new NotifyList<Password>(Context.GetPasswordsByFolderId(Id)) : new NotifyList<Password>(); passwords.Changed += new EventHandler<NotifyEventArgs<Password>>(OnPasswordsChanged); } }
/// <summary> /// Resets all data. /// </summary> protected internal override void Reset() { folders = null; passwords = null; OnPropertyChanged("Folders"); OnPropertyChanged("Passwords"); base.Reset(); }
public FixedLimitsGroupingPresenter(IFixedLimitsGroupingView view, IColorGenerator colorGenerator, ISymbolGenerator symbolGenerator) : base(view) { _colorGenerator = colorGenerator; _symbolGenerator = symbolGenerator; _fixedLimitDTOs = new NotifyList <FixedLimitGroupingDTO>(); }
private void AttachEventRecorders <T>(NotifyList <T> list) { list.ListChanged += _ListChanged.Handler; list.CollectionChanged += _CollectionChanged.Handler; }
/// <summary> /// Resets all data. /// </summary> protected internal override void Reset() { categories = null; passwords = null; fields = null; OnPropertyChanged("Categories"); OnPropertyChanged("Passwords"); OnPropertyChanged("Fields"); base.Reset(); }