示例#1
0
        public List <WatchfaceRendererError> CheckForErrors()
        {
            var errorsList = new List <WatchfaceRendererError>();

            //emptyness
            if (EditorContext.SelectedWatchface.Layers.Count == 0)
            {
                errorsList.Add(new WatchfaceRendererError
                {
                    Severity = WatchfaceRendererErrorSeverity.Error,
                    Object   = "Layers",
                    Message  = "There are no layers in the project"
                });
            }

            //render errors
            FacerWatcfaceRenderer.Render(EditorContext.SelectedWatchface, EditorContext.WatchType, EWatchfaceOverlay.None, true, errorsList);

            //check if there are unused images
            foreach (var img in EditorContext.SelectedWatchface.Images)
            {
                if (!EditorContext.SelectedWatchface.Layers.Any(lyr => lyr.hash == img.Key))
                {
                    errorsList.Add(new WatchfaceRendererError
                    {
                        Severity = WatchfaceRendererErrorSeverity.Warning,
                        Object   = img.Key,
                        Message  = "The image is not being used by any layer"
                    });
                }
            }

            //check if there are unused fonts
            foreach (var fnt in EditorContext.SelectedWatchface.CustomFonts)
            {
                if (!EditorContext.SelectedWatchface.Layers.Any(lyr => lyr.font_hash == fnt.Key && lyr.font_family == (int)FacerFont.Custom))
                {
                    errorsList.Add(new WatchfaceRendererError
                    {
                        Severity = WatchfaceRendererErrorSeverity.Warning,
                        Object   = fnt.Key,
                        Message  = "The font is not being used by any layer"
                    });
                }
            }

            listViewErrors.Items.Clear();
            foreach (var err in errorsList)
            {
                listViewErrors.Items.Add(err.Object, (int)err.Severity).SubItems.Add(err.Message);
            }
            listViewErrors.Columns[0].Width = -1;
            if (listViewErrors.Columns[0].Width < 100)
            {
                listViewErrors.Columns[0].Width = 100;
            }

            return(errorsList);
        }
示例#2
0
        private void RefreshWatch()
        {
            var watchBmp = FacerWatcfaceRenderer.Render(Watchface, EditorContext.WatchType, EditorContext.Overlay, false, null);

            pictureWatch.Image = watchBmp;
        }