Exemple #1
0
        public static NotificationSource GetSource(PXGraph graph, string classID, Guid setupID, int?branchID)
        {
            var notificationSourceSet = PXSelect <NotificationSource,
                                                  Where <
                                                      NotificationSource.setupID, Equal <Required <NotificationSource.setupID> >,
                                                      And <NotificationSource.classID, Equal <Required <NotificationSource.classID> >,
                                                           And <NotificationSource.active, Equal <True> > > > >
                                        .Select(graph, setupID, classID);

            NotificationSource result = null;

            foreach (NotificationSource rec in notificationSourceSet)
            {
                if (rec.NBranchID == branchID)
                {
                    return(rec);
                }

                if (rec.NBranchID == null)
                {
                    result = rec;
                }
            }

            return(result);
        }
Exemple #2
0
        private async void Open_Click(object sender, RoutedEventArgs e)
        {
            var ofn = new OpenFileDialog {
                Filter = CodecFactory.SupportedFilesFilterEn
            };

            if (ofn.ShowDialog() == true)
            {
                _soundOut.Stop();
                if (_notificationSource != null)
                {
                    _notificationSource.Dispose();
                }

                var source = CodecFactory.Instance.GetCodec(ofn.FileName);
                source          = new CachedSoundSource(source);
                source.Position = 0;
                await LoadWaveformsAsync(source);

                source.Position = 0;

                _sampleSource       = source.ToSampleSource();
                _notificationSource = new NotificationSource(_sampleSource)
                {
                    Interval = 100
                };
                _notificationSource.BlockRead += (o, args) => { UpdatePosition(); };
                _soundOut.Initialize(_notificationSource.ToWaveSource());
                _soundOut.Play();
            }
        }
        public virtual void CustomerClass_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            CustomerClass row = (CustomerClass)e.Row;

            if (row == null)
            {
                return;
            }

            NotificationSource source = this.NotificationSources.Select(row.CustomerClassID);

            this.NotificationRecipients.Cache.AllowInsert = source != null;
            PXUIFieldAttribute.SetEnabled <CustomerClass.creditLimit>(cache, row, (row.CreditRule == CreditRuleTypes.CS_CREDIT_LIMIT ||
                                                                                   row.CreditRule == CreditRuleTypes.CS_BOTH));
            PXUIFieldAttribute.SetEnabled <CustomerClass.overLimitAmount>(cache, row, (row.CreditRule == CreditRuleTypes.CS_CREDIT_LIMIT ||
                                                                                       row.CreditRule == CreditRuleTypes.CS_BOTH));
            PXUIFieldAttribute.SetEnabled <CustomerClass.creditDaysPastDue>(cache, row, (row.CreditRule == CreditRuleTypes.CS_DAYS_PAST_DUE ||
                                                                                         row.CreditRule == CreditRuleTypes.CS_BOTH));

            PXUIFieldAttribute.SetEnabled <CustomerClass.smallBalanceLimit>(cache, row, (row.SmallBalanceAllow ?? false));

            PXUIFieldAttribute.SetEnabled <CustomerClass.finChargeID>(cache, row, (row.FinChargeApply ?? false));

            var mcFeatureInstalled = PXAccess.FeatureInstalled <FeaturesSet.multicurrency>();

            PXUIFieldAttribute.SetVisible <CustomerClass.curyID>(cache, null, mcFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CustomerClass.curyRateTypeID>(cache, null, mcFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CustomerClass.printCuryStatements>(cache, null, mcFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CustomerClass.allowOverrideCury>(cache, null, mcFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CustomerClass.allowOverrideRate>(cache, null, mcFeatureInstalled);
        }
 public NotificationAreaMessage(string source, NotificationSource sourceType, NotificationContent contentType)
 {
     this.contentType = contentType;
     this.sourceType = sourceType;
     this.source = source;
     if (source == null)
     throw new ArgumentNullException ("Notification source can't be null.");
     InitComponent ();
 }
Exemple #5
0
 public void ShowError(string text)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                            (ThreadStart) delegate()
     {
         NotificationSource.Show(text, NotificationType.Error);
     }
                            );
 }
Exemple #6
0
        private IEnumerable <NotificationRecipient> GetNotificationRecipients(
            NotificationSource notificationSource, int?vendorId)
        {
            var notificationRecipientsQuery = GetNotificationRecipientsQuery(notificationSource, vendorId);
            var notificationRecipientGroups =
                notificationRecipientsQuery.FirstTableItems.GroupBy(nr => nr.ContactID);

            return(notificationRecipientGroups.Select(nr => GetAppropriateNotificationRecipient(nr.ToList()))
                   .Where(nr => nr.Active == true).ToList());
        }
Exemple #7
0
        public Notification getNotification(bool generateHaveToAct)
        {
            int  sourceIndex = random.Next(0, sourcesNumber);
            bool isSilent    = random.Next(0, 2) == 0;

            if (generateHaveToAct)
            {
                sourceIndex = mapNameToIndex();
                isSilent    = false;
            }
            string             id = Guid.NewGuid().ToString();
            NotificationSource notificationSource = (NotificationSource)Enum.GetValues(typeof(NotificationSource)).GetValue(sourceIndex);
            string             sourceName         = EnumDescription.getDescription(notificationSource);
            NotificationImage  notificationImage  = (NotificationImage)Enum.GetValues(typeof(NotificationImage)).GetValue(sourceIndex);
            string             sourceImage        = EnumDescription.getDescription(notificationImage);
            NotificationColor  notificationColor  = (NotificationColor)Enum.GetValues(typeof(NotificationColor)).GetValue(sourceIndex);
            Color sourceColor = EnumDescription.getColor(EnumDescription.getDescription(notificationColor));
            Array values      = Enum.GetValues(typeof(NotificationAuthor));
            int   authorIndex = random.Next(values.Length);

            if (generateHaveToAct)
            {
                authorIndex = mapAuthorToIndex();
            }
            NotificationAuthor notificationAuthor = (NotificationAuthor)values.GetValue(authorIndex);
            string             author             = EnumDescription.getDescription(notificationAuthor);

            values = Enum.GetValues(typeof(NotificationIcon));
            NotificationIcon notificationIcon = (NotificationIcon)values.GetValue(authorIndex);
            string           icon             = EnumDescription.getDescription(notificationIcon);
            string           text;

            if (sourceIndex == 2 || sourceIndex == 3) // post or youtube
            {
                values = Enum.GetValues(typeof(NotificationHeader));
                NotificationHeader notificationHeader = (NotificationHeader)values.GetValue(random.Next(values.Length));
                text = EnumDescription.getDescription(notificationHeader);
            }
            else // messengers
            {
                values = Enum.GetValues(typeof(NotificationText));
                NotificationText notificationText = (NotificationText)values.GetValue(random.Next(values.Length));
                text = EnumDescription.getDescription(notificationText);
            }
            if (isSilent)
            {
                sourceColor = EnumDescription.getColor(EnumDescription.getDescription(NotificationColor.Silent));
                sourceImage = "_silent_";
            }
            long         timestamp    = DateTime.Now.Ticks;
            Notification notification = new Notification(id, sourceImage, sourceName, author, icon, text, timestamp, isSilent, sourceColor, generateHaveToAct);

            Debug.Log(string.Format("Notification which is {0} and has the following data: {1} was created", generateHaveToAct ? "correct" : "incorrect", notification));
            return(notification);
        }
        public NotificationBubble(string source, NotificationSource sourceType, 
				    NotificationContent contentType)
            : base(WindowType.Popup)
        {
            this.contentType = contentType;
            this.sourceType = sourceType;
            this.source = source;
            if (source == null)
            throw new ArgumentNullException ("Notification source can't be null.");
            InitComponent ();
        }
Exemple #9
0
        private PXResultset <NotificationRecipient> GetNotificationRecipientsQuery(
            NotificationSource notificationSource, int?vendorId)
        {
            var classId = VendorDataProvider.GetVendor(PrintEmailLienWaiversProcess, vendorId).ClassID;

            return(SelectFrom <NotificationRecipient>
                   .Where <NotificationRecipient.setupID.IsEqual <P.AsGuid>
                           .And <NotificationRecipient.sourceID.IsEqual <P.AsInt>
                                 .Or <NotificationRecipient.classID.IsEqual <P.AsString> > > > .View
                   .Select(PrintEmailLienWaiversProcess, notificationSource.SetupID, notificationSource.SourceID, classId));
        }
Exemple #10
0
 public NotificationAreaMessage(string source, NotificationSource sourceType, NotificationContent contentType)
 {
     this.contentType = contentType;
     this.sourceType  = sourceType;
     this.source      = source;
     if (source == null)
     {
         throw new ArgumentNullException("Notification source can't be null.");
     }
     InitComponent();
 }
		internal WlanConnectionNotificationEventArgs(WlanInternNotificationData data, WlanInternNotificationConnectionData c)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
			BssType = c.dot11BssType;
			ProfileName = c.profileName;
			ProfileXml = c.profileXml;
			SecurityEnabled = c.securityEnabled;
			ConnectionMode = c.ConnectionMode;
			ReasonCode = c.wlanReasonCode;
			Ssid = c.Dot11Ssid.GetSsid();
		}
        public static void ShowHtmlNotification(string source, NotificationSource nsource,
						    int width, int height,
						    int timeout, TimerEndedHandler thandler)
        {
            NotificationAreaMessage msg = new NotificationAreaMessage (source, nsource, NotificationContent.Html);
            msg.BubbleWidth = width;
            if (thandler != null)
            msg.TimerEndedEvent += thandler;
            msg.BubbleHeight = height;
            msg.TimeOut = timeout;
            msg.Notify ();
        }
 public NotificationBubble(string source, NotificationSource sourceType,
                           NotificationContent contentType)
     : base(WindowType.Popup)
 {
     this.contentType = contentType;
     this.sourceType  = sourceType;
     this.source      = source;
     if (source == null)
     {
         throw new ArgumentNullException("Notification source can't be null.");
     }
     InitComponent();
 }
Exemple #14
0
        private static void ShowSvgNotification(string source,
                                                NotificationSource nsource,
                                                string header,
                                                string body,
                                                int timeout,
                                                int width,
                                                int height,
                                                NotificationType type,
                                                TimerEndedHandler thandler)
        {
            Stream stream;
            string svg = "";

            if (source == null)
            {
                NotificationFactory factory  = new NotificationFactory();
                Assembly            assembly = Assembly.GetAssembly(factory.GetType());
                stream = assembly.GetManifestResourceStream(type.ToString() + ".svg");
                StreamReader reader = new StreamReader(stream);
                svg = reader.ReadToEnd();
                reader.Close();
                stream.Close();
            }
            else
            {
                if (nsource == NotificationSource.File)
                {
                    stream = new FileStream(source, FileMode.Open, FileAccess.Read);
                    StreamReader reader = new StreamReader(stream);
                    svg = reader.ReadToEnd();
                    reader.Close();
                    stream.Close();
                }
                else if (nsource == NotificationSource.Text)
                {
                    svg = source;
                }
            }

            svg = ReplaceMacros(svg, header, body);
            NotificationAreaMessage msg = new NotificationAreaMessage(svg, NotificationSource.Text, NotificationContent.Svg);

            if (thandler != null)
            {
                msg.TimerEndedEvent += thandler;
            }
            msg.TimeOut      = timeout;
            msg.BubbleWidth  = width;
            msg.BubbleHeight = height;
            msg.Notify();
        }
Exemple #15
0
        public async Task Init()
        {
            var task = LoadWaveformsAsync(AudioEffect.Instance.source);

            _notificationSource = new NotificationSource(new WaveformData.InterruptDisposeChainSource(AudioEffect.Instance.source))
            {
                Interval = 100
            };
            _notificationSource.BlockRead += (o, args) => { UpdatePosition(); };
            _soundOut.Initialize(_notificationSource.ToWaveSource());
            await task;

            _soundOut.Play();
        }
Exemple #16
0
        public static void ShowHtmlNotification(string source, NotificationSource nsource,
                                                int width, int height,
                                                int timeout, TimerEndedHandler thandler)
        {
            NotificationAreaMessage msg = new NotificationAreaMessage(source, nsource, NotificationContent.Html);

            msg.BubbleWidth = width;
            if (thandler != null)
            {
                msg.TimerEndedEvent += thandler;
            }
            msg.BubbleHeight = height;
            msg.TimeOut      = timeout;
            msg.Notify();
        }
Exemple #17
0
        private async void Open_Click(object sender, RoutedEventArgs e)
        {
            var ofn = new OpenFileDialog {
                Filter = CodecFactory.SupportedFilesFilterEn
            };

            if (ofn.ShowDialog() == true)
            {
                _soundOut.Stop();
                if (_notificationSource != null)
                {
                    _notificationSource.Dispose();
                }

                var source = CodecFactory.Instance.GetCodec(ofn.FileName);

                //since the mediafoundationdecoder isn't really accurate what position and length concerns
                //read the whole file into a cache
                if (source is MediaFoundationDecoder)
                {
                    if (source.Length < 10485760) //10MB
                    {
                        source = new CachedSoundSource(source);
                    }
                    else
                    {
                        Stopwatch stopwatch = Stopwatch.StartNew();
                        source = new FileCachedSoundSource(source);
                        stopwatch.Stop();
                        Debug.WriteLine(stopwatch.Elapsed.ToString());
                    }
                }
                source.Position = 0;
                //load the waveform
                await LoadWaveformsAsync(source);

                source.Position = 0;

                _sampleSource       = source.ToSampleSource();
                _notificationSource = new NotificationSource(_sampleSource)
                {
                    Interval = 100
                };
                _notificationSource.BlockRead += (o, args) => { UpdatePosition(); };
                _soundOut.Initialize(_notificationSource.ToWaveSource());
                _soundOut.Play();
            }
        }
        public virtual void VendorClass_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
        {
            VendorClass row = (VendorClass)e.Row;

            if (row == null || row.VendorClassID == null)
            {
                return;
            }

            foreach (APNotification n in
                     PXSelect <APNotification,
                               Where <APNotification.sourceCD, Equal <APNotificationSource.vendor> > > .Select(this))
            {
                NotificationSource source = new NotificationSource();
                source.SetupID = n.SetupID;
                this.NotificationSources.Insert(source);
            }
        }
Exemple #19
0
        public async Task <int> GetIndex(NotificationSource source)
        {
            //multiple requests may try to obtain the new index
            //Therefore, to prevent raise conditions, we need to use locking mechanism.
            //It will ensure that only one thread obtains new index.
            await _lock.WaitAsync();

            try
            {
                var state = await Get();

                state.IncrementIndex(source);
                await Write(state);

                _state = state;
                return(state.GetIndex(source));
            }
            finally
            {
                _lock.Release();
            }
        }
Exemple #20
0
        public void ThrowsInvalidCallerThread()
        {
            Exception exception = null;

            using (var source = new NotificationSource(GetLoopingWaveSource().ToSampleSource()))
            {
                using (var waitHandle = new ManualResetEvent(false))
                {
                    _soundOut.Initialize(source.ToWaveSource());
                    //the play method sometimes won't cause an InvalidOperationException
                    //for example the waveout class will read from the source which fires up the BlockRead event BUT not on the playbackthread.
                    _soundOut.Play();
                    source.BlockRead += (s, e) =>
                    {
                        try
                        {
                            _soundOut.Pause(); //hopefully throws InvalidOperationException
                        }
                        catch (InvalidOperationException ex)
                        {
                            exception = ex;
                        }
                        finally
                        {
// ReSharper disable once AccessToDisposedClosure
                            waitHandle.Set();
                        }
                    };
                    waitHandle.WaitOne();

                    _soundOut.Stop();
                }
            }
            if (exception != null)
            {
                throw exception;
            }
        }
Exemple #21
0
 public void ShowInformation(string message)
 {
     NotificationSource.Show(message, NotificationType.Information);
 }
Exemple #22
0
        public void Run()
        {
            var authent = new Authenticator(_agent, _storage);

            authent.SetupParameters();
            var state = authent.ObserveState();

            authent.CheckEncryptionKey();
            var sender = new MessageSender(_agent);



            var notify = new NotificationSource(_agent);
            var notif  = notify.MessagesNotifications();

            notif.Accept(async notifications =>
            {
                try
                {
                    var mg = notifications.Message.Content as TdApi.MessageContent.MessageText;
                    if (mg.Text.Text.HasValue())
                    {
                        var r = await _dialer.ExecuteAsync(new TdApi.OpenChat {
                            ChatId = notifications.Message.ChatId
                        });

                        var chats = await _dialer.ExecuteAsync(new TdApi.GetChatHistory
                        {
                            ChatId    = notifications.Message.ChatId,
                            Limit     = 10,
                            Offset    = 0,
                            OnlyLocal = false
                        });

                        var result = await _dialer.ExecuteAsync(new TdApi.ViewMessages {
                            ChatId = notifications.Message.ChatId, MessageIds = new[] { notifications.Message.Id }
                        });

                        var rxt = Taker.Talk(mg.Text.Text);

                        var rz = rxt;

                        for (int i = 0; i < 1; i++)
                        {
                            rz += i;

                            var rrr = await _dialer.ExecuteAsync(
                                new TdApi.SendChatAction {
                                ChatId = notifications.Message.ChatId, Action = new TdApi.ChatAction.ChatActionTyping()
                            }
                                );

                            var res = await _dialer.ExecuteAsync(
                                new TdApi.SetChatDraftMessage
                            {
                                ChatId         = notifications.Message.ChatId
                                , DraftMessage = new TdApi.DraftMessage
                                {
                                    InputMessageText = new TdApi.InputMessageContent.InputMessageText
                                    {
                                        Text = new TdApi.FormattedText {
                                            Text = rz
                                        }
                                    }
                                }
                            });
                            Thread.Sleep(5000);
                        }
                        var returnMsg = new TdApi.InputMessageContent.InputMessageText {
                            Text = new TdApi.FormattedText {
                                Text = rxt
                            }, ClearDraft = true
                        };
                        sender.SendMessage(notifications.Chat, returnMsg);

                        var r1 = await _dialer.ExecuteAsync(new TdApi.CloseChat {
                            ChatId = notifications.Message.ChatId
                        });
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            });


            _hub.Start();
        }
 private static bool IsNotificationSourceValid(NotificationSource notificationSource)
 {
     return(notificationSource?.ReportID != null && notificationSource.Active == true);
 }
		/// <summary>
		///     Indicates the reason for an operation failure. This field has a value of <see cref="ReasonCode.Success" />
		///     for all connection-related notifications except <see cref="NotificationCodeAcm.ConnectionComplete" />. If the
		///     connection fails, this field indicates the reason for the failure.
		/// </summary>
		internal WlanNotificationEventArgs(WlanInternNotificationData data)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
		}
Exemple #25
0
 public void IncrementIndex(NotificationSource source) => Indices[Key(source)]++;
        private void OnNotifiedTraceMessage(string notificationMessage, Exception exception, NotificationSource notificationSource, TraceNotificationLevel notificationLevel)
        {
            string notificationMessageFinal = String.Format("{0} Error message is: '{1}'.", notificationMessage, exception.Message);

            OnNotifiedTraceMessage(new TraceNotificationEventArgs(notificationMessageFinal, notificationSource, notificationLevel));
        }
Exemple #27
0
 public void ShowError(string message)
 {
     NotificationSource.Show(message, NotificationType.Error);
 }
Exemple #28
0
 private static string Key(NotificationSource source) => source.ToString().ToLowerInvariant();
Exemple #29
0
 public BackingStoreInfo(NotificationSource source, int index, string id)
 {
     FileId   = id;
     Source   = source.ToString().ToLowerInvariant();
     DirIndex = index;
 }
Exemple #30
0
        private static void Send(AppointmentEntry graphAppointmentEntry, PXCache sourceCache, Guid setupID, int?branchID, IDictionary <string, string> reportParams, IList <Guid?> attachments = null)
        {
            string emailToAccounts, emailBCCAccounts;

            emailToAccounts  = string.Empty;
            emailBCCAccounts = string.Empty;

            FSAppointment fsAppointmentRow = graphAppointmentEntry.AppointmentRecords.Current;

            Guid?refNoteId    = fsAppointmentRow.NoteID;
            Guid?parentNoteId = null;

            string srvOrdType = fsAppointmentRow.SrvOrdType;

            NotificationSource source = GetSource(graphAppointmentEntry, srvOrdType, setupID, branchID);

            if (source == null)
            {
                //The current Notification Type (MailingID) is not configured for this Service Order Type
                return;
            }

            var accountId = source.EMailAccountID ?? DefaultEMailAccountId;

            if (accountId == null)
            {
                sourceCache.RaiseExceptionHandling <FSAppointment.srvOrdType>(
                    sourceCache.Current,
                    ((FSAppointment)sourceCache.Current).SrvOrdType,
                    new PXSetPropertyException(
                        TX.Warning.DEFAULT_EMAIL_NOT_CONFIGURED,
                        PXErrorLevel.Warning));
            }

            RecipientList recipients = GetRecipients(graphAppointmentEntry, source.SourceID, accountId);

            if (recipients == null || recipients.Count() == 0)
            {
                return;
            }

            GetsRecipientsFields(recipients, ref emailToAccounts, ref emailBCCAccounts);

            var sent = false;

            if (source.ReportID != null)
            {
                var sender = new ReportNotificationGenerator(source.ReportID)
                {
                    MailAccountId       = accountId,
                    Format              = source.Format,
                    AdditionalRecipents = recipients,
                    Parameters          = reportParams,
                    NotificationID      = source.NotificationID
                };

                sent |= sender.Send().Any();
            }
            else if (source.NotificationID != null)
            {
                var sender = TemplateNotificationGenerator.Create(fsAppointmentRow, (int)source.NotificationID);
                if (source.EMailAccountID != null)
                {
                    sender.MailAccountId = accountId;
                }

                string notificationBody = sender.Body;
                FSAppointment.ReplaceWildCards(graphAppointmentEntry, ref notificationBody, fsAppointmentRow);

                sender.Body         = notificationBody;
                sender.BodyFormat   = source.Format;
                sender.RefNoteID    = refNoteId;
                sender.ParentNoteID = parentNoteId;
                sender.To           = emailToAccounts;
                sender.Bcc          = emailBCCAccounts;

                if (attachments != null)
                {
                    foreach (var attachment in attachments)
                    {
                        if (attachment != null)
                        {
                            sender.AddAttachmentLink(attachment.Value);
                        }
                    }
                }

                sent |= sender.Send().Any();
            }

            if (!sent)
            {
                throw new PXException(PX.Objects.CR.Messages.EmailNotificationError);
            }
        }
    public static void Main(string[] args)
    {
        Application.Init();
        SimpleOptions options = new SimpleOptions();

        options.ProcessArgs(args);
        bool          collecting    = false;
        StringBuilder textbuilder   = new StringBuilder();
        StringBuilder headerbuilder = new StringBuilder();

        foreach (string s in args)
        {
            if (s == "--text")
            {
                collecting = true;
                continue;
            }
            else if (s.StartsWith("--") && collecting)
            {
                collecting = false;
            }

            if (collecting)
            {
                textbuilder.Append(s + " ");
            }
        }
        options.text = textbuilder.ToString();
        foreach (string s in args)
        {
            if (s == "--header")
            {
                collecting = true;
                continue;
            }
            else if (s.StartsWith("--") && collecting)
            {
                collecting = false;
            }

            if (collecting)
            {
                headerbuilder.Append(s + " ");
            }
        }
        options.header = headerbuilder.ToString();


        if (args.Length == 0)
        {
            options.DoHelp();
            Environment.Exit(1);
        }

        //We are receiving html
        if (options.html)
        {
            NotificationSource sourceType = NotificationSource.Url;
            string             source     = null;
            if (options.content != null)
            {
                sourceType = NotificationSource.Text;
                source     = options.content;
            }
            else if (options.file != null)
            {
                sourceType = NotificationSource.File;
                source     = options.file;
            }
            else if (options.url != null)
            {
                sourceType = NotificationSource.Url;
                source     = options.url;
            }
            else
            {
                options.DoHelp();
            }

            NotificationFactory.ShowHtmlNotification(source, sourceType,
                                                     options.width, options.height,
                                                     options.timeout, new TimerEndedHandler(TimerEnded));
        }

        // We are receiving svg
        else if (options.svg)
        {
            if (options.file != null)
            {
                NotificationFactory.ShowSvgNotification(options.file, options.header,
                                                        options.text, options.width,
                                                        options.height, options.timeout,
                                                        new TimerEndedHandler(TimerEnded));
            }

            else if (options.warning)
            {
                ShowStandardMsg(NotificationType.Warning, options);
            }

            else if (options.info)
            {
                ShowStandardMsg(NotificationType.Info, options);
            }

            else if (options.error)
            {
                ShowStandardMsg(NotificationType.Error, options);
            }

            else
            {
                options.DoHelp();
            }
        }
        else
        {
            options.DoHelp();
        }
        Application.Run();
    }
        private static void ShowSvgNotification(string source,
						NotificationSource nsource,
						string header,
						string body,
						int timeout,
						int width,
						int height,
						NotificationType type,
						TimerEndedHandler thandler)
        {
            Stream stream;
            string svg = "";
            if (source == null)
            {
            NotificationFactory factory = new NotificationFactory ();
            Assembly assembly = Assembly.GetAssembly (factory.GetType ());
            stream = assembly.GetManifestResourceStream (type.ToString () + ".svg");
            StreamReader reader = new StreamReader (stream);
            svg = reader.ReadToEnd ();
            reader.Close ();
            stream.Close ();
            } else {
            if (nsource == NotificationSource.File) {
            stream = new FileStream (source, FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader (stream);
            svg = reader.ReadToEnd ();
            reader.Close ();
            stream.Close ();
            } else if (nsource == NotificationSource.Text)
            svg = source;
            }

            svg = ReplaceMacros (svg, header, body);
            NotificationAreaMessage msg = new NotificationAreaMessage (svg, NotificationSource.Text, NotificationContent.Svg);
            if (thandler != null)
            msg.TimerEndedEvent += thandler;
            msg.TimeOut = timeout;
            msg.BubbleWidth = width;
            msg.BubbleHeight = height;
            msg.Notify ();
        }
Exemple #33
0
 public void ShowSuccess(string message)
 {
     NotificationSource.Show(message, NotificationType.Success);
 }
Exemple #34
0
 public int GetIndex(NotificationSource source) => Indices[Key(source)];
Exemple #35
0
 public void ShowWarning(string message)
 {
     NotificationSource.Show(message, NotificationType.Warning);
 }
Exemple #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DroneException"/> class.
 /// </summary>
 /// <param name="notificationSource">The source where the exception occurred.</param>
 /// <param name="message">The exception message.</param>
 public DroneException(NotificationSource notificationSource, string message)
     : base(message)
 {
     this.NotificationSource = notificationSource;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DroneException"/> class.
 /// </summary>
 /// <param name="notificationSource">The source where the exception occurred.</param>
 /// <param name="message">The exception message.</param>
 public DroneException(NotificationSource notificationSource, string message)
     : base(message)
 {
     this.NotificationSource = notificationSource;
 }
		internal WlanReasonNotificationEventArgs(WlanInternNotificationData data, ReasonCode code)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
			ReasonCode = code;
		}
Exemple #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TraceNotificationEventArgs"/> class.
 /// </summary>
 /// <param name="notificationMessage">The notification message.</param>
 /// <param name="notificationSource">The notification source.</param>
 /// <param name="notificationLevel">The notification level.</param>
 public TraceNotificationEventArgs(string notificationMessage, NotificationSource notificationSource, TraceNotificationLevel notificationLevel)
 {
     this.NotificationMessage = notificationMessage;
     this.NotificationSource  = notificationSource;
     this.NotificationLevel   = notificationLevel;
 }
 private void OnNotifiedTraceMessage(string notificationMessage, NotificationSource notificationSource, TraceNotificationLevel notificationLevel)
 {
     OnNotifiedTraceMessage(new TraceNotificationEventArgs(notificationMessage, notificationSource, notificationLevel));
 }