Exemple #1
0
        public void NotifyStampaBatch(StampaBatchDTO dto, Image image, string message)
        {
            if (!string.IsNullOrEmpty(message))
            {
                CommonMessages.DisplayWarning(string.Format("Si sono verificati degli errori nell'elaborazione della funzione:{0}{1}", Environment.NewLine, message));
                return;
            }

            const ScreenPosition screenPosition = ScreenPosition.BottomRight;

            //  If the UltraDesktopAlert component has not yet been created,
            //  create it now, and set the properties of interest.
            if (_desktopAlert == null)
            {
                _desktopAlert = new UltraDesktopAlert(components)
                {
                    Style = DesktopAlertStyle.WindowsLiveMessenger,
                    CaptionAreaAppearance = {Image = CondominioResources.App_16.ToBitmap()},
                    MainImageAreaBorderColor = Color.Transparent,
                    TextAppearance = {TextHAlign = HAlign.Left},
                    AutoClose = DefaultableBoolean.False
                };
                
                //  There is no specific Appearance exposed for the close button
                //  (or dropdown button), but we can use Application Styling to
                //  change the image that appears.
                //var library = new ApplicationStyleLibrary();
                //var styleSet = library.StyleSets.Add("Default");
                //Image closeImage = CondominioResources.Exit_16.ToBitmap();
                //styleSet.RoleStyles.GetStyle("DesktopAlertCloseButton", true).States.GetState(RoleState.Normal, true).Appearance.Image = closeImage;
                //styleSet.RoleStyles.GetStyle("DesktopAlertCloseButton", true).States.GetState(RoleState.HotTracked, true).Appearance.Image = closeImage;
                //styleSet.RoleStyles.GetStyle("DesktopAlertCloseButton", true).States.GetState(RoleState.Pressed, true).Appearance.Image = closeImage;
                //library.UpdateStyleManager();

                //  Remove the border that appears by default around the main image
                //  by setting the MainImageAreaBorderColor to Transparent.

                //  Set the alignment for the text link to left

                //  Populate the AlertButtons collection
                var alertButtons = _desktopAlert.AlertButtons;

                //  Add a button that enables the end user to unload the stock watcher
                //var button = alertButtons.Add("no_more");
                //button.Appearance.Image = CondominioResources.NoMore_16.ToBitmap();
                //button.ToolTipText = "Stop notifying me about this stock";

                //  Add a button that enables the end user to display data history
                var button = alertButtons.Add("data_history");
                button.Appearance.Image = getStampeBatchUIService().SmallIcon;
                button.ToolTipText = "Visualizza l'elenco delle stampe batch disponibili";

                //  There are no properties for the tooltip text displayed by
                //  the links, but we can change it easily using the resource customizer
                //  since they are localized strings. In this case we should probably hide
                //  the tooltip since clicking it doesn't do anything, so set the resource
                //  value to an empty string.
                Infragistics.Win.Misc.Resources.Customizer.SetCustomizedString("DesktopAlertLinkUIElement_Caption_ToolTipText", string.Empty);
                Infragistics.Win.Misc.Resources.Customizer.SetCustomizedString("DesktopAlertLinkUIElement_Text_ToolTipText", "Clicca qui per aprire il report");

                //  Set the AnimationStyleShow and AnimationStyleAutoClose properties according
                //  to the screen position...if the screen position is such that the desktop alert
                //  windows are not aligned with an edge of the screen, use 'Fade', otherwise, use
                //  'Scroll'
                const AnimationStyle animationStyle = screenPosition == ScreenPosition.Manual ? AnimationStyle.Fade : AnimationStyle.Scroll;

                _desktopAlert.AnimationStyleShow = animationStyle;
                _desktopAlert.AnimationStyleAutoClose = animationStyle;

                //  If we used the 'Fade' setting for the AnimationStyle properties,
                //  set the AnimationSpeed property to 'Slow', only because it looks
                //  a little better. Use 'Fast' for the 'Scroll' AnimationStyle setting.
                _desktopAlert.AnimationSpeed = animationStyle == AnimationStyle.Fade ?
                    AnimationSpeed.Slow :
                    AnimationSpeed.Fast;

                //  Disallow multiple desktop alert windows, so that each new
                //  notification closes the last, if one should happen to be open
                //  at the time the new one appears.
                _desktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.Tiled;

                //  Disallow moving the desktop alert windows
                _desktopAlert.AllowMove = DefaultableBoolean.False;

                //  Center align the footer text
                _desktopAlert.FooterTextAppearance.TextHAlign = HAlign.Center;

                //  Hook the events of interest.
                hookEvents(true);
            }

            //  Create the UltraDesktopAlertShowWindowInfo instance which we will use to
            //  customize the appearance and content for the desktop alert window we are
            //  about to display.
            var showInfo = new UltraDesktopAlertShowWindowInfo
            {
                Caption = "Stampe Batch",
                Text = "<strong>" + dto.Condominio + "</strong><br/><strong>" + dto.Esercizio + "</strong><br/>" + dto.Descrizione + " è ora disponibile",
                Data = dto,
                FooterText = "Visualizza la stampa",
                Image = image,
                ScreenPosition = screenPosition
            };

            //  Show the desktop alert window
            _desktopAlert.Show(showInfo);
        }
Exemple #2
0
        public void AddStampaBatchToCache(StampaBatchDTO stampaBatch)
        {
            var stampaBatchListCache = new List<StampaBatchDTO>();
            if (_cache.Contains("StampaBatch"))
                stampaBatchListCache = (List<StampaBatchDTO>)_cache.GetData("StampaBatch");

            var stampaBatchCache = stampaBatchListCache.FirstOrDefault(item => item.Id == stampaBatch.Id);
            if (stampaBatchCache != null)
                stampaBatchListCache.Remove(stampaBatchCache);
            stampaBatchListCache.Add(stampaBatch);

            _cache.Add
            (
                "StampaBatch",
                stampaBatchListCache,
                CacheItemPriority.Normal,
                new CollectionCacheRefreshAction(),
                new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))
            );
        }
 public void AddStampa(StampaBatchDTO item)
 {
     _cacheService.AddStampaBatchToCache(item);
 }