public static async Task SecurityEvent(this IDataCollection collector, SecurityEventDirection direction, Exception ex) { collector.Write(new SecurityEvent() { Direction = direction, Ex = ex }, DataCollectionSupport.Security); }
public static void LogException(this IDataCollection collector, string message, Exception ex) { collector.Write(new LogEvent(message, ex) { Level = LoggingLevel.Error }); }
private async Task UpdateVideos() { var indicator = new ProgressBar(this); try { indicator.Activated = true; var videos = new ObservableCollection <YouTubeVideo>((await YouTubeDataCollection.LoadVideosAsync("Xamarin Android", "relevance", null, 50)).Item2); _dataCollection = new C1DataCollection <YouTubeVideo>(videos).AsPlain(); await _dataCollection.GroupAsync("ChannelTitle"); RecyclerView.SetLayoutManager(new LinearLayoutManager(this)); RecyclerView.SetAdapter(new YouTubeAdapter(_dataCollection)); } catch { var builder = new Android.App.AlertDialog.Builder(this); builder.SetMessage(Resources.GetString(Resource.String.InternetConnectionError)); var alert = builder.Create(); alert.Show(); } finally { indicator.Activated = false; } }
public static void LogMessage(this IDataCollection collector, string message) { collector.Write(new LogEvent(message) { Level = LoggingLevel.Info }); }
private void PopulateItemsAndGroups(IDataCollection <object> items) { // fill unbound data tree foreach (var obj in items) { var group = obj as IDataCollectionGroup <object, object>; if (group != null) { // create node row var node = c1FlexGrid1.Rows.AddNode(0); node.Row[1] = group.Group; node.Row.Style = c1FlexGrid1.Styles.Alternate; PopulateItemsAndGroups(group.ToDataCollection <YouTubeVideo>()); } else { // create standard unbound row var item = obj as YouTubeVideo; int row = c1FlexGrid1.Rows.Count; c1FlexGrid1.Rows.Add(); c1FlexGrid1.Rows[row].Style = c1FlexGrid1.Styles.Normal; c1FlexGrid1.Rows[row].UserData = item; c1FlexGrid1[row, 2] = item.Title + "\r\n--\r\n" + item.Description; LoadImage(item.Thumbnail, row, 1); } } }
public Repository(IConfiguration configuration) { cncStr = configuration.GetConnectionString("DefaultConnection"); INIT_QUERY_VARS(null); Links = LOAD_DATA <LinkModel>(initLinksQuery); Users = LOAD_DATA <UserBaseModel>(initUsersQuery); }
public TestRepository() { Links = new DataCollection <LinkModel>(new LinkModel[] { new LinkModel() { ShortURL = "123", URL = "https://www.yandex.ru" }, new LinkModel() { ShortURL = "456", URL = "https://www.google.com" } }.AsQueryable()); Users = new DataCollection <UserBaseModel>(new UserBaseModel[] { new UserBaseModel() { Name = "admin1", Password = "******" }, new UserBaseModel() { Name = "admin2", Password = "******" } }.AsQueryable()); }
/// <summary> /// Creates a new error message and adds it to the collection. /// </summary> /// <param name="self">The collection to add the message to.</param> /// <param name="message">The human readable error message as text for string formatting.</param> /// <param name="parms">Paramters for formatting the message text.</param> /// <returns>Returns the error message object that was created.</returns> public static ErrorMessage CreateMessage(this IDataCollection <ErrorMessage> self, string message, params object[] parms) { ErrorMessage msg = new ErrorMessage(string.Format(message, parms)); self.Add(msg); return(msg); }
/// <summary> /// Creates a new error message and adds it to the collection. /// </summary> /// <param name="self">The collection to add the message to.</param> /// <param name="message">The human readable error message.</param> /// <returns>Returns the error message object that was created.</returns> public static ErrorMessage CreateMessage(this IDataCollection <ErrorMessage> self, string message) { ErrorMessage msg = new ErrorMessage(message); self.Add(msg); return(msg); }
public ListViewModel(IDataCollection data) { foreach (var trip in data.BusinessTrips) { BusinessTrips.Add(new BusinessTripViewModel(trip)); } }
/// <summary> /// 请求Api的上下文 /// </summary> /// <param name="httpContext"></param> /// <param name="actionDescriptor"></param> /// <param name="arguments"></param> /// <param name="properties"></param> public ApiRequestContext(HttpContext httpContext, ApiActionDescriptor actionDescriptor, object?[] arguments, IDataCollection properties) { this.HttpContext = httpContext; this.ActionDescriptor = actionDescriptor; this.Arguments = arguments; this.Properties = properties; }
public DetailInfoControl(Database database, IDataCollection collection) { this.InitializeComponent(); this.database = database; this.kryptonHeaderGroup1.ValuesPrimary.Image = null; this.collection = collection; }
public void SetCurrentCollection(IDataCollection collection) { //move to page 1 _currentCollection = collection; DisplayPage(1); UpdateLabelsAndProperties(1, _currentCollection.LastPage, _currentCollection.RecordCount); SetNavigationalButtonState(); }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="serializer">The serialization container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> /// <param name="outgoingRequest">This is the outgoing request initiator.</param> public OnDataCollectionContext( IPayloadSerializationContainer serializer , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId , IMicroserviceDispatch outgoingRequest) : base(serializer, collector, sharedServices, originatorId, outgoingRequest) { }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="serviceHandlers">The service handler container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> /// <param name="outgoingRequest">This is the outgoing request initiator.</param> public OnDataCollectionContext( IServiceHandlers serviceHandlers , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId , IMicroserviceDispatch outgoingRequest) : base(serviceHandlers, collector, sharedServices, originatorId, outgoingRequest) { }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="rq">The incoming request.</param> /// <param name="rsCol">The outgoing response collection.</param> /// <param name="serializer">The serialization container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> /// <param name="outgoingRequest">This is the outgoing request initiator.</param> public CommandMethodRequestContext(TransmissionPayload rq, List <TransmissionPayload> rsCol , IPayloadSerializationContainer serializer , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId , ICommandOutgoing outgoingRequest) : base(rq, rsCol, serializer, collector, sharedServices, originatorId, outgoingRequest) { }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="schedule">The incoming schedule.</param> /// <param name="token">The cancellation token.</param> /// <param name="serializer">The serialization container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> public CommandScheduleInlineContext(Schedule schedule, CancellationToken token , IPayloadSerializationContainer serializer , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId) : base(serializer, collector, sharedServices, originatorId) { Schedule = schedule; Token = token; }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="rq">The incoming request.</param> /// <param name="rsCol">The outgoing response collection.</param> /// <param name="serializer">The serialization container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> public CommandMethodInlineContext(TransmissionPayload rq, List <TransmissionPayload> rsCol , IPayloadSerializationContainer serializer , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId) : base(serializer, collector, sharedServices, originatorId) { Request = rq; Responses = rsCol; }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="rq">The incoming request.</param> /// <param name="rsCol">The outgoing response collection.</param> /// <param name="serviceHandlers">The service handlers container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> /// <param name="outgoingRequest">This is the outgoing request initiator.</param> public CommandRequestContextBase(TransmissionPayload rq, List <TransmissionPayload> rsCol , IServiceHandlers serviceHandlers , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId , O outgoingRequest) : base(serviceHandlers, collector, sharedServices, originatorId, outgoingRequest) { Request = rq; Responses = rsCol; }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="serializer">The serialization container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> public CommandContextBase( IPayloadSerializationContainer serializer , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId) { PayloadSerializer = serializer; Collector = collector; SharedServices = sharedServices; OriginatorId = originatorId; }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="schedule">The incoming schedule.</param> /// <param name="token">The cancellation token.</param> /// <param name="serviceHandlers">The service handler container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> /// <param name="outgoingRequest">This is the outgoing request initiator.</param> public CommandScheduleInlineContext(Schedule schedule, CancellationToken token , IServiceHandlers serviceHandlers , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId , ICommandOutgoing outgoingRequest) : base(serviceHandlers, collector, sharedServices, originatorId, outgoingRequest) { Schedule = schedule; Token = token; }
public FormDataAbstract(IDataCollection collection, Database data) : this() { this.collection = collection; this.database = data; this.controls = new List <Control>(); this.evalControls = new List <Control>(); this.updatedFields = new Dictionary <Field, string>(); this.parser = new Parser(this.GetFieldValue); KeyPreview = true; KeyDown += new KeyEventHandler(this.FormKeyDown); FormClosing += new FormClosingEventHandler(this.FormDataClosing); }
internal CacheContainer(bool isReadOnly) { if (isReadOnly == true) { _collection = new ReadonlyCacheCollection(); } else { _collection = new ConcurrentCacheCollection(); } LoadingStatus = LoadingStatus.None; }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="serviceHandlers">The service handler container.</param> /// <param name="collector">The data collector.</param> /// <param name="sharedServices">The shared service context.</param> /// <param name="originatorId">This is the Microservice identifiers.</param> /// <param name="outgoingRequest">This is the outgoing request initiator.</param> public CommandContextBase( IServiceHandlers serviceHandlers , IDataCollection collector , ISharedService sharedServices , MicroserviceId originatorId , O outgoingRequest) { ServiceHandlers = serviceHandlers; Collector = collector; SharedServices = sharedServices; OriginatorId = originatorId; Outgoing = outgoingRequest; }
public DataProcessing(BlockingCollection <List <double> > dataQueue, BlockingCollection <List <double> > dataQueueToCalculation, DataCollection dataCollection) { //create variables _dataQueueToCalculation = dataQueueToCalculation; _dataQueue = dataQueue; //create relations _dataCollector = dataCollection; _calibrate = new Calibrate(); _unitConverter = new UnitConverter(); _digitalFilter = new DigitalFilter(); _zeroPointAdjustment = new ZeroPointAdjustment(); }
private void SetupApplication() { IDataLoader dataLoader = new FakeLoader(); //IDataLoader dataLoader = new ObjectLoader($"{ _currentDirectory }\\DelegationData.ddc"); _dataCollection = DataAccess.GetCollection(dataLoader); //DataAccess.SaveCollection(_dataCollection, dataLoader); KilometersCard_ComboBox.ItemsSource = _dataCollection.KilometersCards; KilometersCard_ComboBox.SelectedItem = _dataCollection.KilometersCards.FirstOrDefault(); projects_ComboBox.ItemsSource = _dataCollection.Projects; projects_ComboBox.SelectedItem = _dataCollection.Projects.FirstOrDefault(); }
public FormSelectMultipleObjectData(IDataCollection collection, Database database, ObjectClass obj) { InitializeComponent(); this.objectClass = obj; this.database = database; this.collection = collection; foreach (ObjectData d in this.database.Objects.GetData(obj)) { this.listObjects.Items.Add(d); } Text = this.objectClass.Name; }
/// <summary> /// This method is used to record the success rate of a batch poll so that messages can be reconciled against the request, and polling algorithm assessed. /// </summary> /// <param name="collector">The data collector.</param> /// <param name="requested">The number of messages requested.</param> /// <param name="actual">The actual number returned.</param> /// <param name="channelId">The channel id for the request.</param> /// <returns>Returns a trace GUID for the individual boundary listener poll.</returns> public static Guid BoundaryBatchPoll(this IDataCollection collector, int requested, int actual, string channelId, int channelPriority) { var id = Guid.NewGuid(); collector.Write( new BoundaryEvent() { BatchId = id , Requested = requested , Actual = actual , ChannelId = channelId , ChannelPriority = channelPriority , Type = BoundaryEventType.Poll }); return(id); }
/// <summary> /// This interface is used to log payload data when a message is either incoming or outgoing from the system. /// </summary> /// <param name="collector">The data collector.</param> /// <param name="direction">The direction of the message.</param> /// <param name="payload">The payload.</param> /// <param name="ex">Any exception generated by the attempt. If this is not null then you can assume that the incoming or outgoing action was not successful.</param> /// <param name="batchId">The batch id.</param> public static void BoundaryLog(this IDataCollection collector, ChannelDirection direction , TransmissionPayload payload, string channelId, int channelPriority, Exception ex = null, Guid?batchId = null) { collector.Write( new BoundaryEvent() { Direction = direction , ChannelId = payload?.Message?.ChannelId , Id = payload?.Id , Payload = payload , Ex = ex , BatchId = batchId , Type = BoundaryEventType.Boundary , ChannelPriority = channelPriority }); }
//Инициализация формы public MainForm() { InitializeComponent(); this.upperTab.SelectedIndex = 0; //пытаемся проинициализировать БД try { DB = new Database(); UpdateImageNameList(); UpdateSessionsList(); } catch (DatabaseException dEx) { DialogResult result = MessageBox.Show(dEx.Message + Environment.NewLine + "Если вы нажмете 'Ок' база данных будет стерта." + Environment.NewLine + "Если вы нажмете 'Отмена', то данные не будут стерты и программа закроется.", "Упс!" , MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { //Пересоздаем БД - папка с изображениями будет очищена! Database.RemakeDatabase(); //Снова инициализируем БД DB = new Database(); } else if (result == DialogResult.Cancel) { //Выключаем программу Environment.Exit(0); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + "Сейчас программа закроется", "Упс!"); //Выключаем программу Environment.Exit(0); } DC = new DataCollection(DB); DA = new DataAnalysis(DB); InitTransparentPanel(); }
/// <summary> /// Return a collection of <see cref="Node"/>s in this diagram corresponding to some model data. /// </summary> /// <param name="datacoll">an <see cref="IDataCollection"/></param> public virtual IEnumerable<Node> FindNodesForData(IDataCollection datacoll) { if (datacoll == null) return Part.NoNodes; VerifyAccess(); Diagram diagram = this.Diagram; if (diagram == null) return Part.NoNodes; IDiagramModel model = diagram.Model; if (model == null) return Part.NoNodes; return datacoll.Nodes.Select(n => FindNodeForData(n, model)).OfType<Node>(); }
/// <summary> /// Return a collection of <see cref="Link"/>s in this diagram corresponding to some model data. /// </summary> /// <param name="datacoll">an <see cref="IDataCollection"/></param> /// <returns> /// If this model is an <see cref="ILinksModel"/>, this just calls <see cref="FindLinkForData(Object, IDiagramModel)"/> /// and collects the <see cref="Link"/>s that are found. /// Otherwise it looks for <see cref="Link"/>s that are connected to the nodes in the data collection. /// </returns> public virtual IEnumerable<Link> FindLinksForData(IDataCollection datacoll) { if (datacoll == null) return Part.NoLinks; VerifyAccess(); Diagram diagram = this.Diagram; if (diagram == null) return Part.NoLinks; IDiagramModel model = diagram.Model; if (model == null) return Part.NoLinks; if (model is ILinksModel) { return datacoll.Links.Select(l => FindLinkForData(l, model)).Where(l => l != null); } else { return datacoll.Nodes.SelectMany(n => model.GetFromNodesForNode(n).Select(f => FindLinkForData(f, n, model)).Where(l => l != null)) .Concat(datacoll.Nodes.SelectMany(n => model.GetToNodesForNode(n).Select(t => FindLinkForData(n, t, model)).Where(l => l != null))); } }
/// <summary> /// Return a collection of <see cref="Part"/>s in this diagram corresponding to some model data. /// </summary> /// <param name="datacoll"></param> /// <returns>a sequence of both <see cref="Node"/>s and <see cref="Link"/>s</returns> public virtual IEnumerable<Part> FindPartsForData(IDataCollection datacoll) { return FindNodesForData(datacoll).Cast<Part>().Concat(FindLinksForData(datacoll).Cast<Part>()); }
/// <summary> /// Select the <see cref="Part"/>s in this diagram corresponding to a collection of model data. /// </summary> /// <param name="datacoll">an <see cref="IDataCollection"/></param> /// <remarks> /// First this clears this <see cref="Diagram"/>'s selection. /// Then it finds each <see cref="Node"/> or <see cref="Link"/> corresponding /// to the data in <paramref name="datacoll"/> and /// sets its <see cref="Part.IsSelected"/> to true. /// </remarks> public virtual void SelectData(IDataCollection datacoll) { if (datacoll == null) return; VerifyAccess(); Diagram diagram = this.Diagram; if (diagram == null) return; IDiagramModel model = diagram.Model; if (model == null) return; // select all the new nodes and links diagram.ClearSelection(); foreach (Object nodedata in datacoll.Nodes) { Node n = FindNodeForData(nodedata, model); if (n != null) n.IsSelected = true; } if (model is ILinksModel) { foreach (Object linkdata in datacoll.Links) { Link l = FindLinkForData(linkdata, model); if (l != null) l.IsSelected = true; } } else { foreach (Object nodedata in datacoll.Nodes) { foreach (Object fromdata in model.GetFromNodesForNode(nodedata)) { Link link = FindLinkForData(fromdata, nodedata, model); if (link != null) link.IsSelected = true; } foreach (Object todata in model.GetToNodesForNode(nodedata)) { Link link = FindLinkForData(nodedata, todata, model); if (link != null) link.IsSelected = true; } } } }
private bool IsLinkToBeRemoved(Link link, HashSet<Link> sellinks, IDataCollection sel) { // only called when not ILinksModel if (link == null) return false; if (sellinks.Contains(link)) return false; if (link.CachedParentSubGraph != null && sel.ContainsNode(link.CachedParentSubGraph.Data)) return false; return true; }
/// <summary> /// Copy the currently <see cref="Northwoods.GoXam.Diagram.SelectedParts"/> from the <see cref="Diagram"/> /// into the clipboard. /// </summary> /// <remarks> /// This makes a copy of the current selection (by calling <see cref="PartManager.CopyParts"/>) /// and then calls <see cref="CopyToClipboard"/>. /// </remarks> public virtual void Copy() { Diagram diagram = this.Diagram; if (diagram == null) return; IDiagramModel model = diagram.Model; if (model == null) return; PartManager mgr = diagram.PartManager; if (mgr == null) return; try { diagram.Cursor = Cursors.Wait; CommandHandler.InternalClipboard = null; IDataCollection copysel = null; try { HashSet<Part> parts = new HashSet<Part>(); foreach (Part p in diagram.SelectedParts) { GatherCollection(parts, p, this.CopyingInclusions); } ICopyDictionary copyenv = mgr.CopyParts(parts, null); copysel = copyenv.Copies; } catch (Exception ex) { Diagram.Trace(ex.ToString()); //throw; } if (copysel != null) { CommandHandler.InternalClipboard = copysel; try { copysel.Model = null; // try to avoid serializing the model CopyToClipboard(copysel); } catch (Exception ex) { Diagram.Trace(ex.ToString()); } } } finally { diagram.Cursor = null; } }
/// <summary> /// This writes the given data collection to the clipboard /// using the diagram's model's <see cref="IDiagramModel.DataFormat"/>. /// </summary> /// <param name="coll"></param> protected virtual void CopyToClipboard(IDataCollection coll) { Diagram diagram = this.Diagram; if (diagram == null) return; IDiagramModel model = diagram.Model; if (model == null) return; Clipboard.SetData(model.DataFormat, coll); UpdateCommands(); }