Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     if (Panel1)
     {
         msgpane1 = new MessagePane(Panel1, Panel1.transform.Find("MSGText").GetComponent <TextMeshProUGUI>());
     }
 }
Exemplo n.º 2
0
        public RecommendationPane(ContextPage contextPage) : base()
        {
            this.context_page    = contextPage;
            main_box             = this;
            main_box.BorderWidth = 5;

            artist_box = new TitledList(Catalog.GetString("Recommended Artists"));
            artist_box.ShowAll();
            similar_artists_view    = new TileView(2);
            similar_artists_view_sw = new Gtk.ScrolledWindow();
            similar_artists_view_sw.SetPolicy(PolicyType.Never, PolicyType.Automatic);
            similar_artists_view_sw.Add(similar_artists_view);
            similar_artists_view_sw.ShowAll();
            artist_box.PackStart(similar_artists_view_sw, true, true, 0);

            album_box = new TitledList(null);
            album_box.TitleWidthChars = 25;
            album_box.SizeAllocated  += OnSideSizeAllocated;
            album_list = new VBox();
            album_box.PackStart(album_list, false, false, 0);

            track_box = new TitledList(null);
            track_box.SizeAllocated  += OnSideSizeAllocated;
            track_box.TitleWidthChars = 25;
            track_list = new VBox();
            track_box.PackStart(track_list, true, true, 0);

            no_artists_pane           = new MessagePane();
            no_artists_pane.NoShowAll = true;
            no_artists_pane.Visible   = false;
            string no_results_message;

            if (!ApplicationContext.Debugging)
            {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-sad", Stock.DialogError);
                no_results_message         = Catalog.GetString("No similar artists found");
            }
            else
            {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource("no-results.png");
                no_results_message         = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText(no_results_message));
            artist_box.PackEnd(no_artists_pane, true, true, 0);

            main_box.PackStart(artist_box, true, true, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(album_box, false, false, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(track_box, false, false, 5);

            no_artists_pane.Hide();
        }
Exemplo n.º 3
0
 protected bool ShowMessagePane(string message)
 {
     if (MessagePane != null)
     {
         MessagePane.SetMessageThreadSafe(message);
         return(MessagePane.Show());
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Error message handler.
 /// </summary>
 private void AddError(object sender, ErrorEventArgs e)
 {
     Application.Current.Dispatcher.BeginInvoke(
         DispatcherPriority.Background,
         new Action(() =>
     {
         Messages.Add("[" + DateTime.Now.ToString("h:mm:ss tt") + "] ERROR: " + e.Message);
         MessagePane.ScrollIntoView(MessagePane.Items[MessagePane.Items.Count - 1]);
     }
                    )
         );
 }
        public UnsupportedDatabaseView(IpodSource source) : base(source)
        {
            this.source = source;

            pane              = new MessagePane();
            pane.HeaderIcon   = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError);
            pane.ArrowIcon    = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward);
            pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                                              GLib.Markup.EscapeText(Catalog.GetString("Unable to read your iPod")));

            AddPaneItems();

            Add(pane);
            ShowAll();
        }
        public UnsupportedDatabaseView (IpodSource source) : base (source)
        {
            this.source = source;

            pane = new MessagePane();
            pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError);
            pane.ArrowIcon = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward);
            pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                GLib.Markup.EscapeText(Catalog.GetString("Unable to read your iPod")));

            AddPaneItems();

            Add(pane);
            ShowAll ();
        }
        private void OnUpdate(object sender, object e)
        {
            if (!SortedSet <Trader> .CreateSetComparer().Equals(lastCheckedTraderList, Program.Market.TradersListCopy))
            {
                TraderGrid.Children.Clear();
                TraderGrid.RowDefinitions.Clear();
                int i = 0;
                foreach (var trader in Program.Market.TradersListCopy)
                {
                    RowDefinition row = new RowDefinition();
                    row.Height = new GridLength(20);
                    TraderGrid.RowDefinitions.Add(row);
                    Button traderButton = new Button();
                    traderButton.Style   = (Style)Resources["TraderBut"];
                    traderButton.Content = trader.ID;
                    traderButton.Width   = TraderGrid.ColumnDefinitions[0].ActualWidth;
                    TraderGrid.Children.Add(traderButton);
                    Grid.SetRow(traderButton, i++);
                }
            }
            MessageGrid.Children.Clear();
            MessageGrid.RowDefinitions.Clear();
            int j = 0;

            foreach (var message in Program.Market.UiMessageList)
            {
                RowDefinition row = new RowDefinition();
                row.Height = new GridLength(20);
                MessageGrid.RowDefinitions.Add(row);
                TextBlock textToAdd = new TextBlock();
                textToAdd.Text   = message;
                textToAdd.Height = 20;
                textToAdd.Width  = MessageGrid.ColumnDefinitions[0].ActualWidth;
                MessageGrid.Children.Add(textToAdd);
                Grid.SetRow(textToAdd, j++);
            }
            if (Program.Handler != null && Program.Handler.Trader != null)
            {
                YourIDLabel.Text = Program.Handler.Trader.ID;
            }
            if (Program.Market.StockHolder != null)
            {
                StockHolderLabel.Text = Program.Market.StockHolder.ID;
            }
            MessagePane.ScrollToBottom();
            TraderPane.ScrollToBottom();
        }
        private void OnUpdate(object sender, object e)
        {
            if (Program.IsRunning == false)
            {
                Environment.Exit(1);
            }
            TraderGrid.Children.Clear();
            TraderGrid.RowDefinitions.Clear();
            int i = 0;

            foreach (var trader in Market.TraderListCopy)
            {
                RowDefinition row = new RowDefinition();
                row.Height = new GridLength(20);
                TraderGrid.RowDefinitions.Add(row);
                Button traderButton = new Button();
                traderButton.Content = trader.ID;
                traderButton.Width   = TraderGrid.ColumnDefinitions[0].ActualWidth;
                traderButton.Height  = 20;
                TraderGrid.Children.Add(traderButton);
                Grid.SetRow(traderButton, i++);
            }
            MessageGrid.Children.Clear();
            MessageGrid.RowDefinitions.Clear();
            int j = 0;

            foreach (var message in Market.MarketMessagesCopy)
            {
                RowDefinition row = new RowDefinition();
                row.Height = new GridLength(20);
                MessageGrid.RowDefinitions.Add(row);
                TextBlock textToAdd = new TextBlock();
                textToAdd.Text   = message;
                textToAdd.Height = 20;
                textToAdd.Width  = MessageGrid.ColumnDefinitions[0].ActualWidth;
                MessageGrid.Children.Add(textToAdd);
                Grid.SetRow(textToAdd, j++);
            }
            MessagePane.ScrollToBottom();
            TraderPane.ScrollToBottom();
        }
Exemplo n.º 9
0
        public DaapErrorView (DaapSource source, DaapErrorType failure) : base()
        {
            //AppPaintable = true;
            //BorderWidth = 10;

            this.source = source;
            this.failure = failure;

            pane = new MessagePane();
            pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError);
            pane.ArrowIcon = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward);
            pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                GLib.Markup.EscapeText((failure == DaapErrorType.UserDisconnect
                    ? Catalog.GetString("Disconnected from music share")
                    : Catalog.GetString("Unable to connect to music share"))));

            AddPaneItems();
            pane.Show();

            Add(pane);
        }
Exemplo n.º 10
0
        public DaapErrorView(DaapSource source, DaapErrorType failure) : base()
        {
            //AppPaintable = true;
            //BorderWidth = 10;

            this.source  = source;
            this.failure = failure;

            pane              = new MessagePane();
            pane.HeaderIcon   = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError);
            pane.ArrowIcon    = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward);
            pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                                              GLib.Markup.EscapeText((failure == DaapErrorType.UserDisconnect
                    ? Catalog.GetString("Disconnected from music share")
                    : Catalog.GetString("Unable to connect to music share"))));

            AddPaneItems();
            pane.Show();

            Add(pane);
        }
Exemplo n.º 11
0
        public void AddMessage(string message, Brush messageColor)
        {
            Paragraph paragraph = null;

            // delay creating the FlowDocument for the RichTextBox
            // the FlowDocument will contain a single Paragraph, which
            // contains all the logging messages.
            if (MessagePane.Document == null)
            {
                MessagePane.Document = new FlowDocument();
                paragraph            = new Paragraph();
                MessagePane.Document.Blocks.Add(paragraph);
            }
            else
            {
                // if the FlowDocument has been created before, retrieve
                // the last paragraph from it.
                paragraph = (Paragraph)MessagePane.Document.Blocks.LastBlock;
            }

            // each message is represented by a Run element
            var run = new Run(message)
            {
                Foreground = messageColor
            };

            // if the paragraph is non-empty, add a line break before the new message
            if (paragraph.Inlines.Count > 0)
            {
                paragraph.Inlines.Add(new LineBreak());
            }

            paragraph.Inlines.Add(run);

            // scroll to the end to show the latest message
            MessagePane.ScrollToEnd();
        }
Exemplo n.º 12
0
        public RecommendationPane(ContextPage contextPage)
            : base()
        {
            this.context_page = contextPage;
            main_box = this;
            main_box.BorderWidth = 5;

            artist_box = new TitledList (Catalog.GetString ("Recommended Artists"));
            artist_box.ShowAll ();
            similar_artists_view = new TileView (2);
            similar_artists_view_sw = new Gtk.ScrolledWindow ();
            similar_artists_view_sw.SetPolicy (PolicyType.Never, PolicyType.Automatic);
            similar_artists_view_sw.Add (similar_artists_view);
            similar_artists_view_sw.ShowAll ();
            artist_box.PackStart (similar_artists_view_sw, true, true, 0);

            album_box  = new TitledList (null);
            album_box.TitleWidthChars = 25;
            album_box.SizeAllocated += OnSideSizeAllocated;
            album_list = new VBox ();
            album_box.PackStart (album_list, false, false, 0);

            track_box  = new TitledList (null);
            track_box.SizeAllocated += OnSideSizeAllocated;
            track_box.TitleWidthChars = 25;
            track_list = new VBox ();
            track_box.PackStart (track_list, true, true, 0);

            no_artists_pane = new MessagePane ();
            no_artists_pane.NoShowAll = true;
            no_artists_pane.Visible = false;
            string no_results_message;

            if (!ApplicationContext.Debugging) {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon (48, "face-sad", Stock.DialogError);
                no_results_message = Catalog.GetString("No similar artists found");
            } else {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource ("no-results.png");
                no_results_message = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (no_results_message));
            artist_box.PackEnd (no_artists_pane, true, true, 0);

            main_box.PackStart (artist_box, true, true, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (album_box, false, false, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (track_box, false, false, 5);

            no_artists_pane.Hide ();
        }
        private void AddMessageToDialog(MessageLevel level, string message)
        {
            Brush messageBrush;

            // select message color based on MessageLevel value.
            // these colors match the colors in the console, which are set in MyHostUI.cs
            if (SystemParameters.HighContrast)
            {
                // Use the plain System brush
                messageBrush = SystemColors.ControlTextBrush;
            }
            else
            {
                switch (level)
                {
                case MessageLevel.Debug:
                    messageBrush = Brushes.DarkGray;
                    break;

                case MessageLevel.Error:
                    messageBrush = Brushes.Red;
                    break;

                case MessageLevel.Warning:
                    messageBrush = Brushes.Magenta;
                    break;

                default:
                    messageBrush = Brushes.Black;
                    break;
                }
            }

            Paragraph paragraph = null;

            // delay creating the FlowDocument for the RichTextBox
            // the FlowDocument will contain a single Paragraph, which
            // contains all the logging messages.
            if (MessagePane.Document == null)
            {
                MessagePane.Document = new FlowDocument();
                paragraph            = new Paragraph();
                MessagePane.Document.Blocks.Add(paragraph);
            }
            else
            {
                // if the FlowDocument has been created before, retrieve
                // the last paragraph from it.
                paragraph = (Paragraph)MessagePane.Document.Blocks.LastBlock;
            }

            // each message is represented by a Run element
            var run = new Run(message)
            {
                Foreground = messageBrush
            };

            // if the paragraph is non-empty, add a line break before the new message
            if (paragraph.Inlines.Count > 0)
            {
                paragraph.Inlines.Add(new LineBreak());
            }

            paragraph.Inlines.Add(run);

            // scroll to the end to show the latest message
            MessagePane.ScrollToEnd();
        }
        private void CreateWidget()
        {
            ShadowType = ShadowType.In;

            EventBox event_box = new EventBox();

            event_box.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));

            main_box             = new HBox();
            main_box.BorderWidth = 5;

            similar_box = new VBox(false, 3);
            tracks_box  = new VBox(false, 3);
            albums_box  = new VBox(false, 3);

            Label similar_header = new Label();

            similar_header.Xalign    = 0;
            similar_header.Ellipsize = Pango.EllipsizeMode.End;
            similar_header.Markup    = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(
                                                         Catalog.GetString("Recommended Artists")));
            similar_box.PackStart(similar_header, false, false, 0);

            tracks_header            = new Label();
            tracks_header.Xalign     = 0;
            tracks_header.WidthChars = 25;
            tracks_header.Ellipsize  = Pango.EllipsizeMode.End;
            tracks_box.PackStart(tracks_header, false, false, 0);

            albums_header            = new Label();
            albums_header.Xalign     = 0;
            albums_header.WidthChars = 25;
            albums_header.Ellipsize  = Pango.EllipsizeMode.End;
            albums_box.PackStart(albums_header, false, false, 0);

            similar_artists_view = new TileView(2);
            similar_artists_view.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));
            similar_artists_view_sw = new ScrolledWindow();
            similar_artists_view_sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            similar_artists_view_sw.Add(similar_artists_view);
            similar_artists_view_sw.ShowAll();
            similar_box.PackEnd(similar_artists_view_sw, true, true, 0);

            no_artists_pane = new MessagePane();
            string no_results_message;

            if (!Globals.ArgumentQueue.Contains("debug"))
            {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-sad", Stock.DialogError);
                no_results_message         = Catalog.GetString("No similar artists found");
            }
            else
            {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource("no-results.png");
                no_results_message         = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                                                         GLib.Markup.EscapeText(no_results_message));
            similar_box.PackEnd(no_artists_pane, true, true, 0);

            tracks_items_box = new VBox(false, 0);
            tracks_box.PackEnd(tracks_items_box, true, true, 0);

            albums_items_box = new VBox(false, 0);
            albums_box.PackEnd(albums_items_box, true, true, 0);

            main_box.PackStart(similar_box, true, true, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(tracks_box, false, false, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(albums_box, false, false, 5);

            event_box.Add(main_box);
            Add(event_box);
        }
        private void CreateWidget()
        {
            ShadowType = ShadowType.In;

            EventBox event_box = new EventBox();
            event_box.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));

            main_box = new HBox();
            main_box.BorderWidth = 5;

            similar_box = new VBox(false, 3);
            tracks_box = new VBox(false, 3);
            albums_box = new VBox(false, 3);

            Label similar_header = new Label();
            similar_header.Xalign = 0;
            similar_header.Ellipsize = Pango.EllipsizeMode.End;
            similar_header.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(
                Catalog.GetString("Recommended Artists")));
            similar_box.PackStart(similar_header, false, false, 0);

            tracks_header = new Label();
            tracks_header.Xalign = 0;
            tracks_header.WidthChars = 25;
            tracks_header.Ellipsize = Pango.EllipsizeMode.End;
            tracks_box.PackStart(tracks_header, false, false, 0);

            albums_header = new Label();
            albums_header.Xalign = 0;
            albums_header.WidthChars = 25;
            albums_header.Ellipsize = Pango.EllipsizeMode.End;
            albums_box.PackStart(albums_header, false, false, 0);

            similar_artists_view = new TileView(2);
            similar_artists_view.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));
            similar_artists_view_sw = new ScrolledWindow();
            similar_artists_view_sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            similar_artists_view_sw.Add(similar_artists_view);
            similar_artists_view_sw.ShowAll();
            similar_box.PackEnd(similar_artists_view_sw, true, true, 0);

            no_artists_pane = new MessagePane();
            string no_results_message;

            if(!Globals.ArgumentQueue.Contains("debug")) {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-sad", Stock.DialogError);
                no_results_message = Catalog.GetString("No similar artists found");
            } else {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource("no-results.png");
                no_results_message = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                GLib.Markup.EscapeText(no_results_message));
            similar_box.PackEnd(no_artists_pane, true, true, 0);

            tracks_items_box = new VBox(false, 0);
            tracks_box.PackEnd(tracks_items_box, true, true, 0);

            albums_items_box = new VBox(false, 0);
            albums_box.PackEnd(albums_items_box, true, true, 0);

            main_box.PackStart(similar_box, true, true, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(tracks_box, false, false, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(albums_box, false, false, 5);

            event_box.Add(main_box);
            Add(event_box);
        }