Ejemplo n.º 1
0
        internal override void LoadImage(UIConfig.ImageSettings imageSettings, byte[] filedata)
        {
            config = imageSettings;

            mgGif.Decoder decoder = new mgGif.Decoder(filedata);

            var img = decoder.NextImage();

            frameDelayMS = img.Delay;

            List <Texture2D> images = new List <Texture2D>();

            while (img != null)
            {
                Texture2D newtexture = img.CreateTexture(config.Filter);
                newtexture.hideFlags = HideFlags.HideAndDontSave;
                newtexture.DontDestroyOnLoad();

                images.Add(newtexture);
                img = decoder.NextImage();
            }

            textures    = images.ToArray();
            MainTexture = textures[0];
            AspectRatio = MainTexture.width / (float)MainTexture.height;

            AllElements.Add(this);
        }
Ejemplo n.º 2
0
        internal UI_Background(UIConfig.cBackground backgroundSettings)
        {
            config = backgroundSettings;
            image  = UIUtils.LoadImage(config, "Background");

            solidTexture           = UIUtils.CreateColorTexture(config.SolidColor);
            solidTexture.hideFlags = HideFlags.HideAndDontSave;
            solidTexture.DontDestroyOnLoad();
            AllElements.Add(this);
        }
Ejemplo n.º 3
0
        private void Filter()
        {
            AllElements.Clear();
            DBRepository <Elements> dBRepository = new DBRepository <Elements>(new BuildEntities());

            foreach (var item in dBRepository.GetAll().Where(s => s.Type.ToUpper().Contains(Find.ToUpper()) || s.Title.ToUpper().Contains(Find.ToUpper())))
            {
                AllElements.Add(item);
            }
            dBRepository.Dispose();
        }
Ejemplo n.º 4
0
        /// <summary>Creates an instance of the HelloWorld Window </summary>
        public HelloWorldWindow() : base(true, true, ConsoleColor.Gray, ConsoleColor.DarkBlue, ConsoleColor.White, HeaderPosition.CENTER, "Hello World!", 20, 6, -1, -1)
        {
            AllElements.Add(new Icon(this, Icon.IconType.INFORMATION, 1, 2));
            AllElements.Add(new Label(this, "Hello World!", ConsoleColor.Gray, ConsoleColor.Black, 6, 2));

            Button OKButton = new CloseButton(this, "[    OK    ]", ConsoleColor.DarkGray, ConsoleColor.White, ConsoleColor.DarkBlue, 6, 4);

            AllElements.Add(OKButton);

            HighlightedElement   = OKButton;
            OKButton.Highlighted = true;
        }
Ejemplo n.º 5
0
        public NewFileWindow() : base("New File", "==================[New File]================".Length, 10)
        {
            //haha I still will not count it.

            //Megalabel
            AllElements.Add(new Label(this, "Name of File:\n\nMode of File\n\nSize of File:     x", ConsoleColor.Gray, ConsoleColor.Black, 1, 2));

            //FielName box
            Namebox = new Textbox(this, 28, 15, 2, ConsoleColor.DarkGray, ConsoleColor.DarkBlue, ConsoleColor.White);
            AllElements.Add(Namebox);

            String[] Items = { "DF Editor", "HC Editor" };

            //ModeBox
            ModeBox = new LeftRightSelect(this, new List <string>(Items), 28, 15, 4, ConsoleColor.DarkGray, ConsoleColor.DarkBlue, ConsoleColor.White);
            AllElements.Add(ModeBox);

            //XBox and YBox
            XBox = new NumericalTextBox(this, 150, 3, 15, 6, ConsoleColor.DarkGray, ConsoleColor.DarkBlue, ConsoleColor.White);
            YBox = new NumericalTextBox(this, 40, 3, 21, 6, ConsoleColor.DarkGray, ConsoleColor.DarkBlue, ConsoleColor.White);
            AllElements.Add(XBox);
            AllElements.Add(YBox);

            //OKButton
            OKButton = new FlaggedCloseButton(this, "[     OK     ]", ConsoleColor.DarkGray, ConsoleColor.White, ConsoleColor.DarkBlue, 5, 8);
            AllElements.Add(OKButton);

            //CancelButton
            CloseButton Cancelbutton = new CloseButton(this, "[   CANCEL   ]", ConsoleColor.DarkGray, ConsoleColor.White, ConsoleColor.DarkBlue, 26, 8);

            AllElements.Add(Cancelbutton);

            //Link elements
            Namebox.NextElement          = ModeBox;
            ModeBox.PreviousElement      = Namebox;
            ModeBox.NextElement          = XBox;
            XBox.PreviousElement         = ModeBox;
            XBox.NextElement             = YBox;
            YBox.PreviousElement         = XBox;
            YBox.NextElement             = OKButton;
            OKButton.PreviousElement     = YBox;
            OKButton.NextElement         = Cancelbutton;
            Cancelbutton.PreviousElement = OKButton;
            Cancelbutton.NextElement     = Namebox;
            Namebox.PreviousElement      = Cancelbutton;

            //Highlight Element.
            HighlightedElement  = Namebox;
            Namebox.Highlighted = true;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates an Error Window that displays the specified text. <br></br><br></br>
        ///
        /// <b>NOTE!</b><br></br>
        /// ErrorWindow will only display the first three lines of text that it can fit.
        ///
        /// </summary>
        /// <param name="Text"></param>
        public ErrorWindow(string Text) : base(false, true, ConsoleColor.Gray, ConsoleColor.Red, ConsoleColor.White, "Error", 46, 8)
        {
            //First
            AllElements.Add(new Icon(this, Icon.IconType.ERROR, 1, 2));

            //Add the Label
            AllElements.Add(new Label(this, FormattedText.Format(Text, 40, 3), ConsoleColor.Gray, ConsoleColor.Black, 5, 2));

            CloseButton OK = new CloseButton(this, "[     O K     ]", ConsoleColor.DarkGray, ConsoleColor.White, ConsoleColor.DarkBlue, Length - "[     O K     ] ".Length, Height - 2);

            AllElements.Add(OK);
            HighlightedElement = OK;
            OK.Highlighted     = true;
        }
Ejemplo n.º 7
0
        internal UI_ProgressBar(UIConfig.cProgressBar progressBarSettings, UIConfig.TextSettings textSettings)
        {
            config = progressBarSettings;
            text   = new UI_Text(textSettings);

            innerTexture           = UIUtils.CreateColorTexture(config.InnerColor);
            innerTexture.hideFlags = HideFlags.HideAndDontSave;
            innerTexture.DontDestroyOnLoad();

            outerTexture           = UIUtils.CreateColorTexture(config.OuterColor);
            outerTexture.hideFlags = HideFlags.HideAndDontSave;
            outerTexture.DontDestroyOnLoad();

            AllElements.Add(this);
        }
Ejemplo n.º 8
0
        /// <summary>Распределяет элементы по спискам</summary>
        /// <param name="elements">Коллекция элементов для добавления</param>
        public void Add(IEnumerable <LogElement> elements)
        {
            Logger.Log("DataContainer.Add start");

            foreach (LogElement element in elements)
            {
                AllElements.Add(element);

                if (!Module.ContainsKey(element.Tag))
                {
                    Module.Add(element.Tag, new List <LogElement>());
                }
                Module[element.Tag].Add(element);
            }

            Logger.Log("DataContainer.Add done");
        }
Ejemplo n.º 9
0
        public WelcomeWindow() : base(ConsoleColor.Gray, ConsoleColor.DarkMagenta, ConsoleColor.White, "Welcome to BasicRender!", 44, 10)
        {
            AllElements.Add(new Label(this, "Welcome to the BasicRender showcase\n" +
                                      "program! We hope you enjoy the super\n" +
                                      "tiny story we have created to show\n" +
                                      "some of the things this class\n" +
                                      "library can do."
                                      , ConsoleColor.Gray, ConsoleColor.Black, 2, 2));

            Button OKButton = new CloseButton(this, "[      Close      ]", ConsoleColor.DarkGray, ConsoleColor.White, ConsoleColor.DarkBlue, Length - 21, Height - 2);

            AllElements.Add(OKButton);

            Button ShowcaseButton = new LaunchShowcaseButton(this, 2, Height - 2);

            AllElements.Add(ShowcaseButton);

            ShowcaseButton.NextElement = OKButton;
            OKButton.PreviousElement   = ShowcaseButton;

            HighlightedElement         = ShowcaseButton;
            ShowcaseButton.Highlighted = true;
        }
Ejemplo n.º 10
0
        public ErrorWindow(string Text) : base(false, true, ConsoleColor.Gray, ConsoleColor.Red, ConsoleColor.White, "Error", 46, 8)
        {
            //First lets add each element.
            AllElements.Add(new Icon(this, Icon.IconType.ERROR, 1, 2));
            //now lets calculate a label

            //Split the text with spaces
            String[]      Words       = Text.Split(' ');
            int           CurrentWord = 0;
            List <String> Lines       = new List <String>();
            int           LongestLine = 0;

            while (CurrentWord < Words.Length && Lines.Count < 3)
            {
                String Line = "";
                while (CurrentWord < Words.Length && ((Line.Length + Words[CurrentWord].Length) < 40))
                {
                    //If we have a next word, and the word's length is less than
                    Line += Words[CurrentWord] + " ";
                    CurrentWord++;
                }

                LongestLine = Math.Max(LongestLine, Line.Length);

                //The line is as long as its going to be.
                Lines.Add(Line);
            }

            AllElements.Add(new Label(this, String.Join("\n", Lines.ToArray()), ConsoleColor.Gray, ConsoleColor.Black, 5, 2));

            CloseButton OK = new CloseButton(this, "[     O K     ]", ConsoleColor.DarkGray, ConsoleColor.White, ConsoleColor.DarkBlue, Length - "[     O K     ] ".Length, Height - 2);

            AllElements.Add(OK);
            HighlightedElement = OK;
            OK.Highlighted     = true;
        }
Ejemplo n.º 11
0
 internal UI_Text(UIConfig.TextSettings textSettings)
 {
     config = textSettings;
     text   = config.Text;
     AllElements.Add(this);
 }
Ejemplo n.º 12
0
        private async void UpdateExecute()
        {
            try
            {
                projectWatcher?.Watcher?.Dispose();
                if (inUpdate || !Directory.Exists(ShortcutFolder))
                {
                    return;
                }

//                projectWatcher = new FileWatcherRx(ShortcutFolder, "", (NotifyFilters) 19, WatcherChangeTypes.All);
//                projectWatcher.Watcher.IncludeSubdirectories = true;
//                projectWatcher.Created.ObserveOn(dispatcher).Subscribe(s => OnCreatedProject(s.EventArgs));
//                projectWatcher.Deleted.ObserveOn(dispatcher).Subscribe(s => OnDeletedProject(s.EventArgs));
//                projectWatcher.Renamed.ObserveOn(dispatcher).Subscribe(s => OnRenamedProject(s.EventArgs));
//                projectWatcher.Changed.ObserveOn(dispatcher).Subscribe(s => OnChangedProject(s.EventArgs));
                inUpdate = true;
                var files = new List <FileInfo>();
                AllElements.Clear();
                AllProjects.Clear();
                await ShowProgressDialog(c =>
                {
                    c.SetIndeterminate();
                    if (ShortcutFolder == null || !Directory.Exists(ShortcutFolder))
                    {
                        return;
                    }

                    files = GetShortcutFiles(ShortcutFolder).Result;
                }, "Загрузка элементов...", "", false);

                if (!files.Any())
                {
                    ShowMessage("Не найдены файлы быстрых ссылок (xml)");
                    return;
                }

                foreach (var xmls in files.ChunkBy(50))
                {
                    var items = await GetShortcutItems(xmls);

                    foreach (var i in items)
                    {
                        Checks.CheckElement(i);
                        i.Project.Shortcuts.Add(i);
                        AllElements.Add(i);
                    }
                }

                var projects = Project.GetProjects();
                AllProjects.AddRange(projects);
                ProjectsVM.UpdateProjects();
            }
            catch (Exception ex)
            {
                ShowMessage(ex.ToString());
            }
            finally
            {
                inUpdate = false;
            }
        }