Esempio n. 1
0
        public Splash()
        {
            Decorated = false;
            ShowInTaskbar = false;
            box = new VBox {
                Margin = -2,
            };
            imageView = new ImageView {
                Image = Image.FromResource (Resources.Splash),
            };
            progressBar = new ProgressBar {
                Indeterminate = true,
                TooltipText = Catalog.GetString ("Loading..."),
            };
            info = new Label {
                Text = Catalog.GetString ("Loading..."),
                TextAlignment = Alignment.Center,
            };
            box.PackStart (imageView);
            box.PackEnd (progressBar);
            box.PackEnd (info);

            Content = box;

            InitialLocation = WindowLocation.CenterScreen;
        }
Esempio n. 2
0
        public ProgressWidget()
        {
            ProgressMonitor = new ProgressMonitor { Handler = new ProgressWidgetMonitor(this) };

            progressBar = new ProgressBar();
            text = new Label();
            var box = new HBox();
            box.PackStart(progressBar);
            box.PackStart(text, true);
            Content = box;
        }
Esempio n. 3
0
        public ProgressBarSample()
        {
            indeterminateProgressBar = new ProgressBar ();
            PackStart (indeterminateProgressBar, BoxMode.FillAndExpand);
            indeterminateProgressBar.Indeterminate = true;

            timer.Elapsed += Increase;
            determinateProgressBar = new ProgressBar ();
            determinateProgressBar.Fraction = 0.0;
            PackStart(determinateProgressBar, BoxMode.FillAndExpand);
            timer.Start ();
        }
Esempio n. 4
0
		public ProgressBarSample ()
		{
			indeterminateProgressBar = new ProgressBar ();
			PackStart (indeterminateProgressBar, true);
			indeterminateProgressBar.Indeterminate = true;

			timer.Elapsed += Increase;
			determinateProgressBar = new ProgressBar ();
			determinateProgressBar.Fraction = 0.0;
			PackStart(determinateProgressBar, true);
			timer.Start ();

			var spinner = new Spinner ();
			spinner.Animate = true;
			PackStart (spinner);
		}
Esempio n. 5
0
        public MyClass()
        {
            ProgressBar pg = new ProgressBar();

            //Application ap = new Application
        }
Esempio n. 6
0
        public OptionView(LauncherWindow window)
        {
            _texturePacks = new List<TexturePack>();
            _lastTexturePack = null;

            Window = window;
            this.MinWidth = 250;

            OptionLabel = new Label("Options")
            {
                Font = Font.WithSize(16),
                TextAlignment = Alignment.Center
            };

            ResolutionLabel = new Label("Select a resolution...");
            ResolutionComboBox = new ComboBox();

            int resolutionIndex = -1;
            for (int i = 0; i < WindowResolution.Defaults.Length; i++)
            {
                ResolutionComboBox.Items.Add(WindowResolution.Defaults[i].ToString());

                if (resolutionIndex == -1)
                {
                    resolutionIndex =
                        ((WindowResolution.Defaults[i].Width == UserSettings.Local.WindowResolution.Width) &&
                        (WindowResolution.Defaults[i].Height == UserSettings.Local.WindowResolution.Height)) ? i : -1;
                }
            }

            if (resolutionIndex == -1)
            {
                ResolutionComboBox.Items.Add(UserSettings.Local.WindowResolution.ToString());
                resolutionIndex = ResolutionComboBox.Items.Count - 1;
            }

            ResolutionComboBox.SelectedIndex = resolutionIndex;
            FullscreenCheckBox = new CheckBox()
            {
                Label = "Fullscreen mode",
                State = (UserSettings.Local.IsFullscreen) ? CheckBoxState.On : CheckBoxState.Off
            };

            TexturePackLabel = new Label("Select a texture pack...");
            TexturePackImageField = new DataField<Image>();
            TexturePackTextField = new DataField<string>();
            TexturePackStore = new ListStore(TexturePackImageField, TexturePackTextField);
            TexturePackListView = new ListView
            {
                MinHeight = 200,
                SelectionMode = SelectionMode.Single,
                DataSource = TexturePackStore,
                HeadersVisible = false
            };
            OpenFolderButton = new Button("Open texture pack folder");
            BackButton = new Button("Back");

            TexturePackListView.Columns.Add("Image", TexturePackImageField);
            TexturePackListView.Columns.Add("Text", TexturePackTextField);

            ResolutionComboBox.SelectionChanged += (sender, e) =>
            {
                UserSettings.Local.WindowResolution =
                    WindowResolution.FromString(ResolutionComboBox.SelectedText);
                UserSettings.Local.Save();
            };

            FullscreenCheckBox.Clicked += (sender, e) =>
            {
                UserSettings.Local.IsFullscreen = !UserSettings.Local.IsFullscreen;
                UserSettings.Local.Save();
            };

            TexturePackListView.SelectionChanged += (sender, e) =>
            {
                var texturePack = _texturePacks[TexturePackListView.SelectedRow];
                if (_lastTexturePack != texturePack)
                {
                    UserSettings.Local.SelectedTexturePack = texturePack.Name;
                    UserSettings.Local.Save();
                }
            };

            OpenFolderButton.Clicked += (sender, e) =>
            {
                var dir = new DirectoryInfo(TexturePack.TexturePackPath);
                Process.Start(dir.FullName);
            };

            BackButton.Clicked += (sender, e) =>
            {
                Window.MainContainer.Remove(this);
                Window.MainContainer.PackEnd(Window.MainMenuView);
            };

            OfficialAssetsButton = new Button("Download Minecraft assets") { Visible = false };
            OfficialAssetsButton.Clicked += OfficialAssetsButton_Clicked;
            OfficialAssetsProgress = new ProgressBar() { Visible = false, Indeterminate = true };

            LoadTexturePacks();

            this.PackStart(OptionLabel);
            this.PackStart(ResolutionLabel);
            this.PackStart(ResolutionComboBox);
            this.PackStart(FullscreenCheckBox);
            this.PackStart(TexturePackLabel);
            this.PackStart(TexturePackListView);
            this.PackStart(OfficialAssetsProgress);
            this.PackStart(OfficialAssetsButton);
            this.PackStart(OpenFolderButton);
            this.PackEnd(BackButton);
        }
Esempio n. 7
0
        public SingleplayerView(LauncherWindow window)
        {
            Worlds.Local = new Worlds();
            Worlds.Local.Load();

            Window = window;
            this.MinWidth = 250;

            SingleplayerLabel = new Label("Singleplayer")
            {
                Font = Font.WithSize(16),
                TextAlignment = Alignment.Center
            };
            WorldListView = new ListView
            {
                MinHeight = 200,
                SelectionMode = SelectionMode.Single
            };
            CreateWorldButton = new Button("New world");
            DeleteWorldButton = new Button("Delete") { Sensitive = false };
            PlayButton = new Button("Play") { Sensitive = false };
            BackButton = new Button("Back");
            CreateWorldBox = new VBox() { Visible = false };
            NewWorldName = new TextEntry() { PlaceholderText = "Name" };
            NewWorldSeed = new TextEntry() { PlaceholderText = "Seed (optional)" };
            NewWorldCommit = new Button("Create") { Sensitive = false };
            NewWorldCancel = new Button("Cancel");
            NameField = new DataField<string>();
            WorldListStore = new ListStore(NameField);
            WorldListView.DataSource = WorldListStore;
            WorldListView.HeadersVisible = false;
            WorldListView.Columns.Add(new ListViewColumn("Name", new TextCellView { TextField = NameField, Editable = false }));
            ProgressLabel = new Label("Loading world...") { Visible = false };
            ProgressBar = new ProgressBar() { Visible = false, Indeterminate = true, Fraction = 0 };

            BackButton.Clicked += (sender, e) =>
            {
                Window.MainContainer.Remove(this);
                Window.MainContainer.PackEnd(Window.MainMenuView);
            };
            CreateWorldButton.Clicked += (sender, e) =>
            {
                CreateWorldBox.Visible = true;
            };
            NewWorldCancel.Clicked += (sender, e) =>
            {
                CreateWorldBox.Visible = false;
            };
            NewWorldName.Changed += (sender, e) =>
            {
                NewWorldCommit.Sensitive = !string.IsNullOrEmpty(NewWorldName.Text);
            };
            NewWorldCommit.Clicked += NewWorldCommit_Clicked;
            WorldListView.SelectionChanged += (sender, e) =>
            {
                PlayButton.Sensitive = DeleteWorldButton.Sensitive = WorldListView.SelectedRow != -1;
            };
            PlayButton.Clicked += PlayButton_Clicked;
            DeleteWorldButton.Clicked += (sender, e) =>
            {
                var world = Worlds.Local.Saves[WorldListView.SelectedRow];
                WorldListStore.RemoveRow(WorldListView.SelectedRow);
                Worlds.Local.Saves = Worlds.Local.Saves.Where(s => s != world).ToArray();
                Directory.Delete(world.BaseDirectory, true);
            };

            foreach (var world in Worlds.Local.Saves)
            {
                var row = WorldListStore.AddRow();
                WorldListStore.SetValue(row, NameField, world.Name);
            }

            var createDeleteHbox = new HBox();
            CreateWorldButton.WidthRequest = DeleteWorldButton.WidthRequest = 0.5;
            createDeleteHbox.PackStart(CreateWorldButton, true);
            createDeleteHbox.PackStart(DeleteWorldButton, true);

            CreateWorldBox.PackStart(NewWorldName);
            CreateWorldBox.PackStart(NewWorldSeed);
            var newWorldHbox = new HBox();
            NewWorldCommit.WidthRequest = NewWorldCancel.WidthRequest = 0.5;
            newWorldHbox.PackStart(NewWorldCommit, true);
            newWorldHbox.PackStart(NewWorldCancel, true);
            CreateWorldBox.PackStart(newWorldHbox);

            this.PackStart(SingleplayerLabel);
            this.PackStart(WorldListView);
            this.PackStart(createDeleteHbox);
            this.PackStart(PlayButton);
            this.PackStart(CreateWorldBox);
            this.PackStart(ProgressLabel);
            this.PackStart(ProgressBar);
            this.PackEnd(BackButton);
        }