private int GetWebContent(ChannelItem item)
        {
            var url = item.Url;
            int count = 0;
            string htmlCode = HttpRequest.Request(url, "UTF-8");

            int startIndex = htmlCode.IndexOf("<ul id=\"pnl_content\">");

            if (startIndex != -1 && htmlCode.IndexOf("</ul>", startIndex) != -1)
            {
                int endIndex = htmlCode.IndexOf("</ul>", startIndex);

                var litag = htmlCode.Substring(startIndex, endIndex - startIndex);
                string pattern = @"(?<=<li>)[\s\S]*?(?=</li>)";
                foreach (Match mx in Regex.Matches(litag, pattern))
                {
                    // 获取景点名字
                    string pattern2 = @"(?<=<strong>)[\s\S]*?(?=</strong>)";
                    var nameMx = Regex.Match(mx.Value, pattern2);
                    Console.WriteLine(nameMx.Value);

                    // 获取景点地址
                    string pattern3 = @"(?<=<dd>)[\s\S]*?(?=</dd>)";
                    var addressMx = Regex.Match(mx.Value, pattern3);
                    Console.WriteLine(addressMx.Value);

                    count++;
                }
            }

            return count;
        }
        private PrtgClient GetResolvesASensorChannelResponseClient()
        {
            var notificationItem = NotificationTriggerItem.ThresholdTrigger(channel: "Backup State");
            var channelItem      = new ChannelItem(name: "Backup State");

            var client = Initialize_Client(new NotificationTriggerResponse(new[] { notificationItem }, new[] { channelItem }));

            return(client);
        }
        public XElement ToXml()
        {
            XElement RetVal = new XElement("channels");

            foreach (TRssChannel ChannelItem in this)
            {
                RetVal.Add(ChannelItem.ToXml());
            }
            return(RetVal);
        }
        public override string ToString()
        {
            StringBuilder RetVal = new StringBuilder();

            foreach (TRssChannel ChannelItem in this)
            {
                RetVal.AppendLine(ChannelItem.ToString());
            }
            return(RetVal.ToString().Trim('\n'));
        }
Beispiel #5
0
        public void Save()
        {
            XDocument SavedDocument = new XDocument();

            SavedDocument.Add(this.ToXml());

            SavedDocument.Save(Name);
            foreach (TLocalChannel ChannelItem in _GetChannels(this.RootGroup))
            {
                ChannelItem.Save();
            }
        }
Beispiel #6
0
 public void logChannelItem(ChannelItem c)
 {
     nChannels++;
     currentPKEvent = 0;
     logStream.WriteStartElement("PKEvents");
     logStream.WriteAttributeString("EventName", c.ImpliedEventName);
     logStream.WriteAttributeString("Channel", c.Channel.Text);
     logStream.WriteAttributeString("Detrend", c.TrendDegree.Text);
     logStream.WriteAttributeString("FilterLength", c._filterN.ToString("0"));
     logStream.WriteAttributeString("MinimumLength", c._minimumL.ToString("0"));
     logStream.WriteAttributeString("Threshold", c._threshold.ToString("G"));
 }
        private string GetDescriptionExcerptFromItemProperties(ChannelItem channelItem)
        {
            var maxLength             = 255;
            var channelItemProperties = channelItem?.Properties;
            var description           = GetInformationFromChannelItemProperties(channelItemProperties, "descriptions");

            if ((description ?? string.Empty).Length > maxLength)
            {
                return(string.Join(string.Empty, description.Take(maxLength)) + "...");
            }

            return(description);
        }
Beispiel #8
0
 private void _okButton_Click(object sender, EventArgs e)
 {
     if (_channelsListView.SelectedItems.Count > 0)
     {
         ChannelItem channelItem = _channelsListView.SelectedItems[0].Tag as ChannelItem;
         ChannelLinks.SetLinkedMediaPortalChannel(this.Channel, channelItem.Channel);
     }
     else
     {
         ChannelLinks.ClearLinkedMediaPortalChannel(this.Channel);
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
        public static ChannelItem find(this ObservableCollection <ChannelItem> list, string name)
        {
            ChannelItem target = null;

            foreach (ChannelItem item in list)
            {
                if (item.isSameChannel(name))
                {
                    target = item;
                    break;
                }
            }

            return(target);
        }
Beispiel #10
0
		public PieciStation() : base("E. Europe Standard Time") { // Latvijas laika josla.
			channels=Settings.Default.Channels;
			// Pēc noklusējuma atstāj ētera kanālu.
			if (channels == null || channels.Count == 0) {
				var fmChannel=new ChannelItem(FmId, "5 FM", 0x2D3191.ToColor());
				if (channels == null)
					channels=new List<ChannelItem>(1) { fmChannel };
				else channels.Add(fmChannel);
				Settings.Default.Channels=channels;
				hasSettingsChanges=true;
			}

			SetChannels();
			Settings.Default.PropertyChanged+=settings_PropertyChanged;
		}
Beispiel #11
0
        private void CreateShareForm_Load(object sender, EventArgs e)
        {
            _channelNameLabel.Text = this.Channel.DisplayName;
            LoadGroups();

            LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(this.Channel);

            if (linkedChannel != null)
            {
                SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.GroupMap));
                sb.AddConstraint(Operator.Equals, "idChannel", linkedChannel.Id);
                SqlResult result = Broker.Execute(sb.GetStatement());
                List <TvDatabase.GroupMap> groupMaps = (List <TvDatabase.GroupMap>)
                                                       ObjectFactory.GetCollection(typeof(TvDatabase.GroupMap), result, new List <TvDatabase.GroupMap>());
                if (groupMaps.Count > 0)
                {
                    foreach (ListViewItem item in _groupsListView.Items)
                    {
                        if (item.Tag is int &&
                            (int)item.Tag == groupMaps[0].IdGroup)
                        {
                            item.Selected = true;
                            _groupsListView.EnsureVisible(item.Index);
                            break;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }

                    foreach (ListViewItem item in _channelsListView.Items)
                    {
                        ChannelItem channelItem = item.Tag as ChannelItem;
                        if (channelItem.Channel.IdChannel == linkedChannel.Id)
                        {
                            item.Selected = true;
                            _channelsListView.EnsureVisible(item.Index);
                            break;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }
                }
            }
        }
        public static bool isSameChannel(this ChannelItem item, string cname)
        {
            var name = cname.Trim();

            if (item.ItemName.Equals(name))
            {
                return(true);
            }

            if ((item is TemplateItem) && (item as TemplateItem).Id.Equals(name))
            {
                return(true);
            }

            return(false);
        }
Beispiel #13
0
        public void InteractorReturnsDescriptionExcerptPropertyFromRepository()
        {
            var channelItem = new ChannelItem
            {
                Properties = new Dictionary <string, IEnumerable <object> >
                {
                    { "descriptions", new[] { DescriptionStub } }
                }
            };

            SetUpSpecified(new GetChannelItemRepositoryReturnsSpecificResponseStub(channelItem));

            var response = interactor.Execute("AAA-BBB-CCC-DDD");

            Assert.Equal("Das Spiel ist zeitlich zwischen den Ereignissen von Der Hobbit und Der Herr der Ringe angesiedelt. Die Haupthandlung dreht sich um Talion, einen Waldläufer von Gondor, welcher, als der dunkle Herrscher Sauron mit seiner Armee die Herrschaft über Mordor an...", response.DescriptionExcerpt);
        }
Beispiel #14
0
        public void InteractorReturnsDescriptionPropertyFromRepository()
        {
            var channelItem = new ChannelItem
            {
                Properties = new Dictionary <string, IEnumerable <object> >
                {
                    { "descriptions", new[] { DescriptionStub } }
                }
            };

            SetUpSpecified(new GetChannelItemRepositoryReturnsSpecificResponseStub(channelItem));

            var response = interactor.Execute("AAA-BBB-CCC-DDD");

            Assert.Equal(DescriptionStub, response.Description);
        }
Beispiel #15
0
        public void InteractorReturnsTitlePropertyFromRepository()
        {
            var channelItem = new ChannelItem
            {
                Properties = new Dictionary <string, IEnumerable <object> >
                {
                    { "titles", new[] { "Lord of the rings: Shadow of mordor" } }
                }
            };

            SetUpSpecified(new GetChannelItemRepositoryReturnsSpecificResponseStub(channelItem));

            var response = interactor.Execute("AAA-BBB-CCC-DDD");

            Assert.Equal("Lord of the rings: Shadow of mordor", response.Title);
        }
Beispiel #16
0
        public void TestMethod1()
        {
            string config = @".\config\config.ini";

            YouTubeDataProvider ydp      = new YouTubeDataProvider((new IniFile(config)["API", "key"]));
            Schedule            schedule = new Schedule(config);

            ChannelItem item = new ChannelItem();

            item.Initialize("https://www.youtube.com/channel/UC87o3e14Vh9lQ6BhZXqC6GQ", ydp, schedule);
            item.StartMoniterLiveStatus();

            Thread.Sleep(60000);

            Assert.AreEqual(DateTime.Now, item.LiveData.LastRequestTime);             // 実行結果の確認
        }
Beispiel #17
0
        public void FillAutoPlayChannels(ObservableCollection <ChannelItem> channels = null)
        {
            AutoPlayChannels.Clear();

            var first = new ChannelItem()
            {
                Name          = "Nespouštět žádný kanál",
                ChannelNumber = "-1"
            };
            var second = new ChannelItem()
            {
                Name          = "Posledně vybraný kanál",
                ChannelNumber = "0"
            };

            AutoPlayChannels.Add(first);
            AutoPlayChannels.Add(second);

            var anythingSelected = false;

            foreach (var ch in channels)
            {
                AutoPlayChannels.Add(ch);

                if (ch.ChannelNumber == Config.AutoPlayChannelNumber)
                {
                    anythingSelected    = true;
                    SelectedChannelItem = ch;
                }
            }

            if (!anythingSelected)
            {
                if (Config.AutoPlayChannelNumber == "0")
                {
                    SelectedChannelItem = second;
                }
                else
                {
                    SelectedChannelItem = first;
                }
            }

            OnPropertyChanged(nameof(AutoPlayChannels));
        }
Beispiel #18
0
        private async Task ShowRecordNotification(ChannelItem channel)
        {
            try
            {
                string subTitle = String.Empty;
                string detail   = "Probíhá nahrávání";
                if (channel.CurrentEPGItem != null)
                {
                    subTitle = channel.CurrentEPGItem.Title;
                }

                _notificationHelper.ShowRecordNotification(2, channel.Name, subTitle, detail);
            }
            catch (Exception ex)
            {
                _loggingService.Error(ex);
            }
        }
Beispiel #19
0
            private static XmlDocument WideLiveTile(ChannelItem channel)
            {
                var tileTemplate = TileTemplateType.TileWideSmallImageAndText04;
                var tileXml      = TileUpdateManager.GetTemplateContent(tileTemplate);

                // Set notification image
                XmlNodeList imgNodes = tileXml.GetElementsByTagName("image");

                imgNodes[0].Attributes[1].NodeValue = channel.Image;

                // Set notification text
                XmlNodeList textNodes = tileXml.GetElementsByTagName("text");

                textNodes[0].InnerText = channel.Name;
                textNodes[1].InnerText = channel.Description;

                return(tileXml);
            }
Beispiel #20
0
        public IActorChannel GetActorChannelByIdentifier(string identifier)
        {
            if (string.IsNullOrEmpty(identifier))
            {
                throw new ArgumentNullException("identifier");
            }

            ChannelItem item = null;

            item = _channels.Values.FirstOrDefault(i => i.ChannelIdentifier == identifier);
            if (item != null)
            {
                return(item.Channel);
            }

            throw new ActorNotFoundException(string.Format(
                                                 "Cannot find channel by identifier, Identifier[{0}].", identifier));
        }
Beispiel #21
0
        public async Task Play(ChannelItem channel)
        {
            try
            {
                if (Config.InternalPlayer)
                {
                    MessagingCenter.Send <BaseViewModel, ChannelItem> (this, BaseViewModel.PlayInternal, channel);
                }
                else
                {
                    MessagingCenter.Send(channel.UrlWithQuality(Config.StreamQuality), BaseViewModel.UriMessage);
                }
            }
            catch (Exception ex)
            {
                _loggingService.Error(ex, "PlayStream general error");

                await _dialogService.Information(ex.ToString());
            }
        }
Beispiel #22
0
        private async Task ShowPlayingNotification(ChannelItem channel)
        {
            try
            {
                string subTitle = String.Empty;
                string detail   = String.Empty;
                if (channel.CurrentEPGItem != null)
                {
                    subTitle = channel.CurrentEPGItem.Title;
                    detail   = channel.CurrentEPGItem.Start.ToString("HH:mm")
                               + " - " +
                               channel.CurrentEPGItem.Finish.ToString("HH:mm");
                }

                _notificationHelper.ShowPlayNotification(1, channel.Name, subTitle, detail);
            } catch (Exception ex)
            {
                _loggingService.Error(ex);
            }
        }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        ChannelItem itm = new ChannelItem();

        itm.BoxWidth           = this.BoxWidth;
        itm.TitleLength        = this.TitleLength;
        itm.Width              = this.Width;
        itm.LeftWidth          = this.LeftWidth;
        itm.RightWidth         = this.RightWidth;
        itm.Height             = this.Height;
        itm.BoxSpace           = this.BoxSpace;
        itm.isHoverEffect      = this.isHoverEffect;
        itm.BreakLine          = this.BreakLine;
        itm.isAdmin            = this.isAdmin;
        itm.ThumbPreviewOption = this.ThumbPreviewOption;
        itm.ThumbOnly          = this.ThumbOnly;
        itm.ShowDate           = this.ShowDate;
        itm.DateFormat         = this.DateFormat;
        itm.ShowViews          = this.ShowViews;
        itm.ShowDisabled       = this.ShowDisabled;
        itm.PreviewUrl         = this.PreviewUrl;
        itm.ContentLayout      = this.ContentLayout;
        itm.BoxCssClass        = this.BoxCssClass;
        itm.HoverCssClass      = this.HoverCssClass;
        itm.AltCssClass        = this.AltCssClass;
        itm.ThumbCssClass      = this.ThumbCssClass;
        itm.BoldLinkCssClass   = this.BoldLinkCssClass;
        itm.NormalLinkCssClass = this.NormalLinkCssClass;
        itm.AltLinkCssClass    = this.AltLinkCssClass;
        itm.GoodCssClass       = this.GoodCssClass;
        itm.NormalTextCssClass = this.NormalTextCssClass;
        itm.BadCssClass        = this.BadCssClass;
        itm.ShowLocationInfo   = this.ShowLocationInfo;
        itm.ShowMessageLink    = this.ShowMessageLink;
        itm.ShowAddFriendLink  = this.ShowAddFriendLink;
        itm.ShowUserName       = this.ShowUserName;
        itm.DateCaption        = this.DateCaption;
        itm.UserCaption        = this.UserCaption;

        Item = itm.Process(this.PH);
    }
Beispiel #24
0
        public void InteractorReturnsMainImagePropertyFromRepository()
        {
            var channelItem = new ChannelItem
            {
                Properties = new Dictionary <string, IEnumerable <object> >
                {
                    {
                        "images",
                        new[] {
                            "http://de.web.img2.acsta.net/r_1920_1080/pictures/16/11/16/11/48/237316.jpg",
                            "http://de.web.img2.acsta.net/r_1920_1080/pictures/16/11/16/11/55/237316.jpg"
                        }
                    }
                }
            };

            SetUpSpecified(new GetChannelItemRepositoryReturnsSpecificResponseStub(channelItem));

            var response = interactor.Execute("AAA-BBB-CCC-DDD");

            Assert.Equal("http://de.web.img2.acsta.net/r_1920_1080/pictures/16/11/16/11/48/237316.jpg", response.MainImageUrl);
        }
Beispiel #25
0
            public static void SetLiveTile(ChannelItem channel)
            {
                var update = TileUpdateManager.CreateTileUpdaterForApplication();

                if (channel == null)
                {
                    update.Clear();
                    return;
                }

                var smallXml  = SmallLiveTile(channel);
                var smallTile = new TileNotification(smallXml);

                smallTile.ExpirationTime = DateTime.Now + TimeSpan.FromMinutes(30);
                update.Update(smallTile);

                var wideXml  = WideLiveTile(channel);
                var wideTile = new TileNotification(wideXml);

                wideTile.ExpirationTime = DateTime.Now + TimeSpan.FromMinutes(30);
                update.Update(wideTile);
            }
Beispiel #26
0
        private bool ActivateChannel(IActorChannel channel)
        {
            channel.ChannelConnected    += OnActorChannelConnected;
            channel.ChannelDisconnected += OnActorChannelDisconnected;
            channel.ChannelDataReceived += OnActorChannelDataReceived;

            ManualResetEventSlim waitingConnected = new ManualResetEventSlim(false);
            object connectedSender = null;
            ActorChannelConnectedEventArgs connectedEvent             = null;
            EventHandler <ActorChannelConnectedEventArgs> onConnected =
                (s, e) =>
            {
                connectedSender = s;
                connectedEvent  = e;
                waitingConnected.Set();
            };

            channel.ChannelConnected += onConnected;
            channel.Open();

            bool connected = waitingConnected.Wait(TimeSpan.FromSeconds(5));

            channel.ChannelConnected -= onConnected;
            waitingConnected.Dispose();

            if (connected && channel.Active)
            {
                var item = new ChannelItem(((IActorChannel)connectedSender).Identifier, (IActorChannel)connectedSender);
                item.RemoteActorKey = connectedEvent.RemoteActor.GetKey();
                item.RemoteActor    = connectedEvent.RemoteActor;
                _channels.TryAdd(channel.Identifier, item);
                return(true);
            }
            else
            {
                CloseChannel(channel);
                return(false);
            }
        }
Beispiel #27
0
        private ChannelItem GetChannelProductByProductId(int productId, int channelId)
        {
            var metaData = new LinqMetaData();
            var channel  = metaData.ChannelItem.SingleOrDefault(p => p.ProductId == productId && p.ChannelId == channelId);

            if (channel == null)
            {
                return(null);
            }
            var channelItem = new ChannelItem();

            //Mapping fields
            channelItem.ChannelId      = channel.ChannelId;
            channelItem.ChannelItemId  = channel.ChannelItemId;
            channelItem.ProductId      = channel.ProductId;
            channelItem.TesterMerchQty = channel.TesterMerchQty;
            channelItem.Comments       = channel.Comments;
            channelItem.LiveMerchQty   = channel.LiveMerchQty;
            channelItem.NumStores      = channel.NumStores;
            channelItem.SampleQty      = channel.SampleQty;

            return(channelItem);
        }
Beispiel #28
0
        /// <summary>
        /// Generate the Channels section of the AsyncApi schema from the
        /// <see cref="ChannelAttribute"/> on methods.
        /// </summary>
        private static IDictionary <string, ChannelItem> GenerateChannelsFromMethods(IEnumerable <TypeInfo> asyncApiTypes, AsyncApiSchemaResolver schemaResolver, AsyncApiOptions options, JsonSchemaGenerator jsonSchemaGenerator, IServiceProvider serviceProvider)
        {
            var channels = new Dictionary <string, ChannelItem>();

            var methodsWithChannelAttribute = asyncApiTypes
                                              .SelectMany(type => type.DeclaredMethods)
                                              .Select(method => new
            {
                Channel = method.GetCustomAttribute <ChannelAttribute>(),
                Method  = method,
            })
                                              .Where(mc => mc.Channel != null);

            foreach (var mc in methodsWithChannelAttribute)
            {
                var channelItem = new ChannelItem
                {
                    Description = mc.Channel.Description,
                    Parameters  = GetChannelParametersFromAttributes(mc.Method, schemaResolver, jsonSchemaGenerator),
                    Publish     = GenerateOperationFromMethod(mc.Method, schemaResolver, OperationType.Publish, options, jsonSchemaGenerator, serviceProvider),
                    Subscribe   = GenerateOperationFromMethod(mc.Method, schemaResolver, OperationType.Subscribe, options, jsonSchemaGenerator, serviceProvider),
                    Bindings    = mc.Channel.BindingsRef != null ? new ChannelBindingsReference(mc.Channel.BindingsRef) : null,
                    Servers     = mc.Channel.Servers?.ToList(),
                };
                channels.Add(mc.Channel.Name, channelItem);

                var context = new ChannelItemFilterContext(mc.Method, schemaResolver, jsonSchemaGenerator, mc.Channel);
                foreach (var filterType in options.ChannelItemFilters)
                {
                    var filter = (IChannelItemFilter)serviceProvider.GetRequiredService(filterType);
                    filter.Apply(channelItem, context);
                }
            }

            return(channels);
        }
Beispiel #29
0
        /// <summary>
        /// Generate the Channels section of the AsyncApi schema from the
        /// <see cref="ChannelAttribute"/> on classes.
        /// </summary>
        private static IDictionary <string, ChannelItem> GenerateChannelsFromClasses(IEnumerable <TypeInfo> asyncApiTypes, AsyncApiSchemaResolver schemaResolver, AsyncApiOptions options, JsonSchemaGenerator jsonSchemaGenerator, IServiceProvider serviceProvider)
        {
            var channels = new Dictionary <string, ChannelItem>();

            var classesWithChannelAttribute = asyncApiTypes
                                              .Select(type => new
            {
                Channel = type.GetCustomAttribute <ChannelAttribute>(),
                Type    = type,
            })
                                              .Where(cc => cc.Channel != null);

            foreach (var cc in classesWithChannelAttribute)
            {
                var channelItem = new ChannelItem
                {
                    Description = cc.Channel.Description,
                    Parameters  = GetChannelParametersFromAttributes(cc.Type, schemaResolver, jsonSchemaGenerator),
                    Publish     = GenerateOperationFromClass(cc.Type, schemaResolver, OperationType.Publish, jsonSchemaGenerator),
                    Subscribe   = GenerateOperationFromClass(cc.Type, schemaResolver, OperationType.Subscribe, jsonSchemaGenerator),
                    Bindings    = cc.Channel.BindingsRef != null ? new ChannelBindingsReference(cc.Channel.BindingsRef) : null,
                    Servers     = cc.Channel.Servers?.ToList(),
                };

                channels.AddOrAppend(cc.Channel.Name, channelItem);

                var context = new ChannelItemFilterContext(cc.Type, schemaResolver, jsonSchemaGenerator, cc.Channel);
                foreach (var filterType in options.ChannelItemFilters)
                {
                    var filter = (IChannelItemFilter)serviceProvider.GetRequiredService(filterType);
                    filter.Apply(channelItem, context);
                }
            }

            return(channels);
        }
Beispiel #30
0
        public void ActivateLocalActor(ActorIdentity localActor)
        {
            if (localActor == null)
            {
                throw new ArgumentNullException("localActor");
            }
            if (_localActor != null)
            {
                throw new InvalidOperationException("The local actor has already been activated.");
            }

            var channel = _factory.BuildLocalActor(localActor);

            channel.ChannelConnected    += OnActorChannelConnected;
            channel.ChannelDisconnected += OnActorChannelDisconnected;
            channel.ChannelDataReceived += OnActorChannelDataReceived;

            try
            {
                channel.Open();

                _localActor = localActor;

                var item = new ChannelItem(channel.Identifier, channel);
                item.RemoteActorKey = _localActor.GetKey();
                item.RemoteActor    = _localActor;
                _channels.Add(channel.Identifier, item);

                _log.DebugFormat("Local actor [{0}] is activated on channel [{1}].", _localActor, channel);
            }
            catch
            {
                CloseChannel(channel);
                throw;
            }
        }
Beispiel #31
0
        public IActorChannel GetActorChannel(string actorType, string actorName)
        {
            if (string.IsNullOrEmpty(actorName))
            {
                return(GetActorChannel(actorType));
            }

            var         actorKey = ActorIdentity.GetKey(actorType, actorName);
            ChannelItem item     = null;

            item = _channels.Values.FirstOrDefault(i => i.RemoteActorKey == actorKey);
            if (item != null)
            {
                return(item.Channel);
            }

            lock (_syncLock)
            {
                item = _channels.Values.FirstOrDefault(i => i.RemoteActorKey == actorKey);
                if (item != null)
                {
                    return(item.Channel);
                }

                BuildActorChannel(actorType, actorName);

                item = _channels.Values.FirstOrDefault(i => i.RemoteActorKey == actorKey);
                if (item != null)
                {
                    return(item.Channel);
                }

                throw new ActorNotFoundException(string.Format(
                                                     "Build actor channel failed, cannot connect remote actor, Type[{0}], Name[{1}].", actorType, actorName));
            }
        }
        private void TestTriggerChannel(TriggerChannel channel, string[] urls, bool isSensor, ChannelItem channelItem = null)
        {
            var countOverride = new Dictionary <Content, int>
            {
                [Content.Sensors] = isSensor ? 2 : 0
            };

            var itemOverride = channelItem != null
                ? new Dictionary <Content, BaseItem[]>
            {
                [Content.Channels] = new[] { channelItem }
            }
                : null;

            var parameters = new ThresholdTriggerParameters(1001)
            {
                Channel = channel
            };

            Execute(
                c => c.AddNotificationTrigger(parameters, false),
                urls,
                countOverride,
                itemOverride
                );
        }
Beispiel #33
0
 private void AddSpec_Click(object sender, RoutedEventArgs e)
 {
     ChannelItem ci = new ChannelItem(this);
     ChannelEntries.Items.Add(ci);
     ci.Channel.SelectedIndex = 0;
     checkError();
 }
Beispiel #34
0
        private void PerformOpenPFile()
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open parameter file ...";
            dlg.DefaultExt = ".par"; // Default file extension
            dlg.Filter = "PAR Files (.par)|*.par"; // Filter files by extension
            dlg.InitialDirectory = Properties.Settings.Default.LastParFile;
            bool result = dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK;
            if (!result) return;

            Properties.Settings.Default.LastParFile = System.IO.Path.GetDirectoryName(dlg.FileName);

            XmlReaderSettings xrs = new XmlReaderSettings();
            xrs.CloseInput = true;
            xrs.IgnoreWhitespace = true;
            XmlReader xml = XmlReader.Create(new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read), xrs);
            try
            {
                xml.ReadStartElement("PKDAParameters");
                FNExtension.Text = xml.ReadElementString("OutputFilenameExt");
                xml.ReadStartElement("CreatedEvents");
                while (!ChannelEntries.Items.IsEmpty) ChannelEntries.Items.RemoveAt(0);
                while (xml.Name == "EventDescription")
                {
                    ChannelItem ci = new ChannelItem(this);
                    if (ci.ReadNewSettings(xml))
                        ChannelEntries.Items.Add(ci);
                }
                xml.ReadEndElement(/* CreatedEvents */);
                xml.ReadEndElement(/* PKDAParameters */);
                Status.Text = "Parameter file successfully imported";
            }
            catch (XmlException e)
            {
                Status.Text = "Parameter file error: " + e.Message;
            }
            xml.Close();
            checkError();
        }
Beispiel #35
0
        public MainWindow()
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open Header file ...";
            dlg.DefaultExt = ".hdr"; // Default file extension
            dlg.Filter = "HDR Files (.hdr)|*.hdr"; // Filter files by extension
            dlg.InitialDirectory = Properties.Settings.Default.LastDataset;
            DialogResult result = dlg.ShowDialog();
            if (result != System.Windows.Forms.DialogResult.OK) Environment.Exit(0);

            directory = System.IO.Path.GetDirectoryName(dlg.FileName);
            Properties.Settings.Default.LastDataset = directory;
            headerFileName = System.IO.Path.GetFileNameWithoutExtension(dlg.FileName);

            CCIUtilities.Log.writeToLog("Starting PKDetectorAnalyzer " + CCIUtilities.Utilities.getVersionNumber() +
                " on " + headerFileName);

            head = (new HeaderFileReader(dlg.OpenFile())).read();

            bdf = new BDFEDFFileReader(
                new FileStream(System.IO.Path.Combine(directory, head.BDFFile),
                    FileMode.Open, FileAccess.Read));
            for (int i = 0; i < bdf.NumberOfChannels; i++) //first see if this file has standard transducer labels
                if (bdf.transducer(i) == "Analog Input Box")
                    channels.Add(new channelOptions(i, bdf.channelLabel(i))); //if it does, use them as channel choices
            if (channels.Count == 0) //if it does not, then show all channels
                for (int i = 0; i < bdf.NumberOfChannels; i++)
                    channels.Add(new channelOptions(i, bdf.channelLabel(i)));
            AnalogChannelCount = channels.Count;

            OpenPCommand.InputGestures.Add(
                new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift, "Ctrl+Shift+O"));
            SavePCommand.InputGestures.Add(
                new KeyGesture(Key.S, ModifierKeys.Control, "Crtl+S"));
            ProcessCommand.InputGestures.Add(
                new KeyGesture(Key.P, ModifierKeys.Control, "Crtl+P"));
            ExitCommand.InputGestures.Add(new KeyGesture(Key.Q, ModifierKeys.Control, "Crtl+Q"));

            InitializeComponent();

            //***** Set up menu commands and short cuts

            CommandBinding cbOpenP = new CommandBinding(OpenPCommand, cbOpen_Execute, cbOpen_CanExecute);
            this.CommandBindings.Add(cbOpenP);

            CommandBinding cbSaveP = new CommandBinding(SavePCommand, cbSave_Execute, validParams_CanExecute);
            this.CommandBindings.Add(cbSaveP);

            CommandBinding cbProcess = new CommandBinding(ProcessCommand, ProcessChannels_Click, validParams_CanExecute);
            this.CommandBindings.Add(cbProcess);

            CommandBinding cbExit = new CommandBinding(ExitCommand, Quit_Click, cbExit_CanExecute);
            this.CommandBindings.Add(cbExit);

            //***** Set up defaults and other housekeeping

            Title = headerFileName;
            TitleLine.Text = directory + System.IO.Path.DirectorySeparatorChar + headerFileName;
            FNExtension.Text = "PKDetection";
            DataContext = this;

            ChannelItem ci = new ChannelItem(this);
            ChannelEntries.Items.Add(ci);
            ci.Channel.SelectedIndex = 0;
            Process.IsEnabled = true; //have to reenable here -- like checkError(); values are guarenteed valid however

            this.Activate();
        }
Beispiel #36
0
 internal workerArguments(ChannelItem ci, MainWindow mw)
 {
     channelItem = ci;
     channelNumber = mw.channels[ci.Channel.SelectedIndex].channel;
     data = mw.bdf.readAllChannelData(channelNumber); //read in next data channel
     samplingRate = (double)mw.bdf.NumberOfSamples(channelNumber) / mw.bdf.RecordDurationDouble;
     trendDegree = ci.TrendDegree.SelectedIndex - 1;
     filterLength = ci._filterN;
     threshold = ci._threshold;
     minLength = ci._minimumL;
 }
    private void BindList()
    {
        StringBuilder str = new StringBuilder();
        this.TotalRecords = 0;
        this.TotalRecords = _members.Count_Channels(this.Term, this.Character, this.AccountType, this.Country, this.Gender, this.HavePhoto, this.Filter, this.isCache);
        if (this.TotalRecords == 0)
        {
            // no records found
            pg.Visible = false;
            str.Append("<div class=\"bx_norecord\">");
            str.Append("<h4>" + NoRecordFound + "</h4>");
            str.Append("</div>");
            lst.InnerHtml = str.ToString();
            return;
        }
        List<Member_Struct> _list = null;
        _list = _members.Load_Channels_ADV(this.Term, this.Character, this.AccountType, this.Country, this.Gender, this.HavePhoto, this.Filter, this.Order, this.PageNumber, this.PageSize, this.AdvList, this.isCache);
        if (_list.Count > 0)
        {
            if (Site_Settings.Pagination_Type == 2)
            {
                // sql server 2000 compatibility
                this.TotalRecords = _list.Count;
            }

            // Maximum Pagination Restriction for Main Listing
            int maximum_allowed_records = Site_Settings.Pagination_Links * this.PageSize;
            if (this.TotalRecords > maximum_allowed_records)
                this.TotalRecords = maximum_allowed_records;

            if (this.isListStatus)
            {
                // List Statistic Display
                list_stat1.TotalRecords = this.TotalRecords;
                list_stat1.PageSize = this.PageSize;
                list_stat1.PageNumber = this.PageNumber;
            }
            else
            {
                // disable showing list status on top of page
                lstat.Visible = false;
            }

            if (this.TotalRecords > this.PageSize)
            {
                pagination1.TotalRecords = this.TotalRecords;
                pagination1.PageSize = this.PageSize;
                pagination1.PageNumber = this.PageNumber;
                pagination1.Default_Url = this.Default_Url;
                pagination1.Pagination_Url = this.Pagination_Url;
                if (this.Filter > 0)
                {
                    pagination1.isFilter = true;
                    pagination1.Filter_Default_Url = this.Filter_DefaultUrl;
                    pagination1.Filter_Pagination_Url = this.Filter_Pagination_Url;
                }
                pagination1.BindPagination();
            }
            else
            {
                pg.Visible = false;
            }

           
            // generate channel listing 
            int i = 0;
            int counter = 0;
            //int total_columns = 6;

            ChannelItem itm = new ChannelItem();
            if (this.AdvList)
            {
                // advance listing options
                itm.ContentLayout = 1; // left / right side listing type
                itm.LeftWidth = 13;
                itm.RightWidth = 86;
                itm.NormalLinkCssClass = "xxmedium-text bold";
                itm.AltLinkCssClass = "normal-text light";
                itm.BoxCssClass = "bx_br_bt item_pad_4";
                itm.isHoverEffect = true;
                itm.ShowLocationInfo = true;
                itm.Height = 64;
                itm.Width = 64;
                itm.ShowViews = true;
                itm.ShowDate = true;
            }
            else
            {
                // normal listing options
                itm.ShowDate = false;
                itm.isHoverEffect = false;
                itm.NormalLinkCssClass = "mini-text bold";
                itm.AltLinkCssClass = "mini-text light";
                itm.BoxWidth = 75;
                itm.BoxSpace = 10;
                itm.Width = 62;
                itm.Height = 62;
                itm.TitleLength = 8;
                itm.ShowViews = true;
            }
            for (i = 0; i <= _list.Count - 1; i++)
            {
                counter = counter + 1;
                str.Append(itm.Process(_list[i]));
            }
            str.Append("<div class=\"clear\"></div>"); // clear floating items
        }
        else
        {
            pg.Visible = false;
            str.Append("<div class=\"bx_norecord\">");
            str.Append("<h4>" + NoRecordFound + "</h4>");
            str.Append("</div>");
        }

        lst.InnerHtml = str.ToString();
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        ChannelItem itm = new ChannelItem();
        itm.BoxWidth = this.BoxWidth;
        itm.TitleLength =this.TitleLength;
        itm.Width=this.Width;
        itm.LeftWidth =this.LeftWidth;
        itm.RightWidth = this.RightWidth;
        itm.Height=this.Height;
        itm.BoxSpace =this.BoxSpace;
        itm.isHoverEffect=this.isHoverEffect;
        itm.BreakLine=this.BreakLine;
        itm.isAdmin=this.isAdmin;
        itm.ThumbPreviewOption = this.ThumbPreviewOption;
        itm.ThumbOnly=this.ThumbOnly;
        itm.ShowDate =this.ShowDate;
        itm.DateFormat=this.DateFormat;
        itm.ShowViews=this.ShowViews;
        itm.ShowDisabled=this.ShowDisabled;
        itm.PreviewUrl=this.PreviewUrl;
        itm.ContentLayout=this.ContentLayout;
        itm.BoxCssClass=this.BoxCssClass;
        itm.HoverCssClass=this.HoverCssClass;
        itm.AltCssClass=this.AltCssClass;
        itm.ThumbCssClass=this.ThumbCssClass;
        itm.BoldLinkCssClass=this.BoldLinkCssClass;
        itm.NormalLinkCssClass=this.NormalLinkCssClass;
        itm.AltLinkCssClass=this.AltLinkCssClass;
        itm.GoodCssClass=this.GoodCssClass;
        itm.NormalTextCssClass=this.NormalTextCssClass;
        itm.BadCssClass=this.BadCssClass;
        itm.ShowLocationInfo=this.ShowLocationInfo;
        itm.ShowMessageLink=this.ShowMessageLink;
        itm.ShowAddFriendLink=this.ShowAddFriendLink;
        itm.ShowUserName=this.ShowUserName;
        itm.DateCaption=this.DateCaption;
        itm.UserCaption=this.UserCaption;

        Item = itm.Process(this.PH);
    }
Beispiel #39
0
 public GetChannelItemRepositoryReturnsSpecificResponseStub(ChannelItem channelItemEntity)
 {
     this.channelItemEntity = channelItemEntity;
 }