Пример #1
0
            public PadTitleWindow(DockFrame frame, DockItem draggedItem) : base(Gtk.WindowType.Popup)
            {
                SkipTaskbarHint = true;
                Decorated       = false;
                TransientFor    = (Gtk.Window)frame.Toplevel;
                TypeHint        = WindowTypeHint.Utility;

                var mainBox = new VBox();

                var box = new HBox(false, 3);

                if (draggedItem.Icon != null)
                {
                    var img = new Xwt.ImageView(draggedItem.Icon);
                    box.PackStart(img.ToGtkWidget(), false, false, 0);
                }
                var la = new Label();

                la.Markup = draggedItem.Label;
                box.PackStart(la, false, false, 0);

                mainBox.PackStart(box, false, false, 0);

                var f = new CustomFrame();

                f.SetPadding(12, 12, 12, 12);
                f.SetMargins(1, 1, 1, 1);
                f.Add(mainBox);

                Add(f);
                ShowAll();
            }
Пример #2
0
        public async Task Initialize(CustomFrame frame)
        {
            SimpleIoc.Default.Register <IAsyncNavigationService>(() => { return(new NavigationService(frame)); });
            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            isLoggedin = await AuthService.checkAuth();
            await Load();

            await ConfigureAdsVisibility();
        }
Пример #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Frame> e)
        {
            base.OnElementChanged(e);

            customFrame = Element as CustomFrame;

            if (e.NewElement != null)
            {
                ApplyCornerRadius();
            }
        }
Пример #4
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Set the right theme-depending color for the alternating rows
            if (SettingsService.Get <bool>(SettingsKeys.AppLightThemeEnabled))
            {
                XAMLHelper.AssignValueToXAMLResource("OddAlternatingRowsBrush", new SolidColorBrush {
                    Color = Color.FromArgb(0x08, 0, 0, 0)
                });
            }

            CustomFrame rootFrame = Window.Current.Content as CustomFrame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new CustomFrame();

                rootFrame.NavigationFailed += OnNavigationFailed;
            }

            if (!e.PrelaunchActivated)
            {
                if (rootFrame.Content == null)
                {
                    Window.Current.Content = new MainPage();
                }

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
                {
                    var view = ApplicationView.GetForCurrentView();
                    view.SetPreferredMinSize(new Size(width: 800, height: 600));

                    var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    if (titleBar != null)
                    {
                        titleBar.BackgroundColor = titleBar.ButtonBackgroundColor = (Color)App.Current.Resources["SystemAltHighColor"];
                    }
                }

                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Пример #5
0
        public DocumentTitleWindow(PlaceholderWindow placeholder, DockNotebookTab draggedItem) : base(Gtk.WindowType.Toplevel)
        {
            this.placeholder = placeholder;

            SkipTaskbarHint = true;
            Decorated       = false;

            //TransientFor = parent;
            TypeHint = WindowTypeHint.Utility;

            VBox mainBox = new VBox();

            mainBox.Spacing = 3;

            titleBox = new HBox(false, 3);
            if (draggedItem.Icon != null)
            {
                var img = new Xwt.ImageView(draggedItem.Icon);
                titleBox.PackStart(img.ToGtkWidget(), false, false, 0);
            }
            Gtk.Label la = new Label();
            la.Markup = draggedItem.Text;
            titleBox.PackStart(la, false, false, 0);

            mainBox.PackStart(titleBox, false, false, 0);

            var wi = RenderWidget(draggedItem.Content);

            if (wi != null)
            {
                wi = wi.WithBoxSize(200);
                mainBox.PackStart(new ImageView(wi), false, false, 0);
            }

            CustomFrame f = new CustomFrame();

            f.SetPadding(2, 2, 2, 2);
            f.SetMargins(1, 1, 1, 1);
            f.Add(mainBox);

            Add(f);
            mainBox.CanFocus = true;
            Child.ShowAll();
        }
            public CustomTrace(StackTrace stackTrace)
            {
                this._stackTrace = stackTrace;

                // Find a useful name to display
                StackFrame[] frames = stackTrace.GetFrames();
                for (_nameIndex = 0; _nameIndex < frames.Length; ++_nameIndex)
                {
                    StackFrame frame = frames[_nameIndex];
                    if (!IsCreationMethod(frame.GetMethod()))
                    {
                        break;
                    }
                }
                int startIndex = fullTrace ? 0 : _nameIndex;

                // Create a custom trace from the frames
                _frames = new CustomFrame[stackTrace.FrameCount - startIndex];
                for (int i = 0; i < _frames.Length; ++i)
                {
                    _frames[i] = new CustomFrame(frames[i + startIndex]);
                }
            }
Пример #7
0
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;
            Spacing     = 0;

            // Feedback button

            CustomFrame fr = new CustomFrame(0, 0, 1, 1);

            Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource("balloon.png");
            HBox       b  = new HBox(false, 3);

            b.PackStart(new Gtk.Image(px));
            b.PackStart(new Gtk.Label("Feedback"));
            Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
            al.RightPadding = 5;
            al.LeftPadding  = 3;
            al.Add(b);
            feedbackButton = new MiniButton(al);
            //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
            fr.Add(feedbackButton);
            PackStart(fr, false, false, 0);
            feedbackButton.Clicked                += HandleFeedbackButtonClicked;
            feedbackButton.ButtonPressEvent       += HandleFeedbackButtonButtonPressEvent;;
            feedbackButton.ClickOnRelease          = true;
            FeedbackService.FeedbackPositionGetter = delegate {
                int x, y;
                feedbackButton.GdkWindow.GetOrigin(out x, out y);
                x += feedbackButton.Allocation.Width;
                y -= 6;
                return(new Gdk.Point(x, y));
            };

            // Dock area

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            // Status panels

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
Пример #8
0
        internal MonoDevelopStatusBar()
        {
            BorderWidth   = 0;
            Spacing       = 0;
            HasResizeGrip = true;

            Accessible.Role = Atk.Role.Filler;

            HeaderBox hb = new HeaderBox(1, 0, 0, 0);

            hb.Accessible.Role = Atk.Role.Filler;
            hb.StyleSet       += (o, args) => {
                hb.BorderColor     = Styles.DockSeparatorColor.ToGdkColor();
                hb.BackgroundColor = Styles.DockBarBackground.ToGdkColor();
            };
            var mainBox = new HBox();

            mainBox.Accessible.Role = Atk.Role.Filler;
            var alignment = new Alignment(0f, 0f, 0f, 0f);

            alignment.Accessible.Role = Atk.Role.Filler;
            mainBox.PackStart(alignment, true, true, 0);
            hb.Add(mainBox);
            hb.ShowAll();
            PackStart(hb, true, true, 0);

            // Dock area

            CustomFrame dfr = new CustomFrame(0, 0, 1, 0);

            dfr.Accessible.Role = Atk.Role.Filler;
            dfr.StyleSet       += (o, args) => {
                dfr.BorderColor = Styles.DockSeparatorColor.ToGdkColor();
            };
            dfr.ShowAll();
            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
            var dockBar         = wb.DockFrame.ExtractDockBar(PositionType.Bottom);

            dockBar.AlignToEnd = true;
            dockBar.ShowBorder = false;
            dockBar.NoShowAll  = true;
            dfr.Add(dockBar);
            mainBox.PackStart(dfr, false, false, 0);

            // Resize grip

            resizeGrip.Accessible.SetRole(AtkCocoa.Roles.AXGrowArea);
            resizeGrip.WidthRequest  = ResizeGripWidth;
            resizeGrip.HeightRequest = 0;
            resizeGrip.VisibleWindow = false;
            mainBox.PackStart(resizeGrip, false, false, 0);

            resizeGrip.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                if (args.Event.Button == 1)
                {
                    GdkWindow.BeginResizeDrag(Gdk.WindowEdge.SouthEast, (int)args.Event.Button, (int)args.Event.XRoot, (int)args.Event.YRoot, args.Event.Time);
                }
            };

            this.ShowAll();

//			// todo: Move this to the CompletionWindowManager when it's possible.
//			StatusBarContext completionStatus = null;
//			CompletionWindowManager.WindowShown += delegate {
//				CompletionListWindow wnd = CompletionWindowManager.Wnd;
//				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
//					if (completionStatus == null)
//						completionStatus = CreateContext ();
//					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
//				}
//			};
        }
        void CreateView()
        {
            var statusDataTemplate = new DataTemplate(() =>
            {
                var gridLayout = new Grid {
                    RowSpacing = 10, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(10, 0), BackgroundColor = Color.Red
                };

                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });
                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });

                gridLayout.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(30, GridUnitType.Absolute)
                });
                var outerlayout = new StackLayout {
                    Margin = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start
                };
                var layout = new StackLayout {
                    Orientation = StackOrientation.Horizontal, Margin = 10, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                var label1 = new CustomLabel {
                    HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = 130
                };
                var label2 = new CustomLabel {
                    HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 130, Text = "Completed"
                };
                gridLayout.Children.Add(label1, 0, 0);
                gridLayout.Children.Add(label2, 1, 0);
                layout.Children.Add(label1);
                layout.Children.Add(label2);
                outerlayout.Children.Add(layout);
                Grid.SetColumnSpan(outerlayout, 2);
                gridLayout.Children.Add(outerlayout);
                return(new ViewCell {
                    View = gridLayout, Height = 30
                });
            });

            var titleDataTemplate = new DataTemplate(() =>
            {
                var gridLayout = new Grid {
                    RowSpacing = 10, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(10, 0), BackgroundColor = Color.Blue
                };

                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });
                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });

                gridLayout.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var outerlayout = new StackLayout {
                    Margin = 10
                };
                var layout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal, Margin = 0
                };
                var label1 = new CustomLabel {
                    HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = 130, Text = "Property"
                };
                var label2 = new CustomLabel {
                    HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 130, BindingKey = "13LA"
                };
                gridLayout.Children.Add(label1, 0, 0);
                gridLayout.Children.Add(label2, 1, 0);
                layout.Children.Add(label1);
                layout.Children.Add(label2);
                outerlayout.Children.Add(layout);
                Grid.SetColumnSpan(outerlayout, 2);
                gridLayout.Children.Add(outerlayout);
                return(new ViewCell {
                    View = gridLayout, Height = 40
                });
            });

            var entryDataTemplate = new DataTemplate(() =>
            {
                var gridLayout = new Grid {
                    RowSpacing = 10, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(10, 0), BackgroundColor = Color.Yellow
                };

                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });
                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });

                gridLayout.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var outerlayout = new StackLayout {
                    Margin = 0
                };
                var layout = new StackLayout {
                    Orientation = StackOrientation.Vertical, Margin = 10
                };
                var label = new CustomLabel {
                    HorizontalOptions = LayoutOptions.StartAndExpand, BindingKey = "Note"
                };
                var entry = new CustomEditor
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    HeightRequest     = 100,
                    IsEnabled         = true,
                    Text                = "nothing",
                    BackgroundColor     = Color.Transparent,
                    RoundedCornerRadius = 20,
                    BorderWidth         = 1,
                    BorderColor         = Color.Transparent
                };
                var frame = new CustomFrame {
                    CornerRadius = 20, Content = entry, Padding = 0, HasShadow = true
                };
                gridLayout.Children.Add(label, 0, 0);
                gridLayout.Children.Add(frame, 0, 0);
                Grid.SetColumnSpan(frame, 2);
                layout.Children.Add(label);
                layout.Children.Add(frame);
                outerlayout.Children.Add(layout);
                Grid.SetColumnSpan(layout, 2);
                Grid.SetColumnSpan(outerlayout, 2);
                gridLayout.Children.Add(outerlayout);
                return(new ViewCell {
                    View = gridLayout, Height = 150
                });
            });
            var btntemplate = new DataTemplate(() =>
            {
                var gridLayout = new Grid {
                    RowSpacing = 0, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(10, 0), BackgroundColor = Color.Gray
                };

                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });
                gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                });

                gridLayout.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var outerlayout = new StackLayout {
                    Margin = new Thickness(0)
                };
                var layout = new StackLayout {
                    Orientation = StackOrientation.Horizontal, Margin = 10
                };
                var btn1 = new RoundedButtonLeft
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    Text            = "left",
                    BackgroundColor = Color.Green,
                    CornerRadius    = 0,
                    TextColor       = Color.White
                };
                var btn2 = new RoundedButtonRight
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    Text            = "right",
                    BackgroundColor = Color.Green,
                    CornerRadius    = 0,
                    TextColor       = Color.White
                };
                gridLayout.Children.Add(btn1, 0, 0);
                gridLayout.Children.Add(btn2, 1, 0);
                layout.Children.Add(btn1);
                layout.Children.Add(btn2);
                outerlayout.Children.Add(layout);
                Grid.SetColumnSpan(outerlayout, 2);
                gridLayout.Children.Add(outerlayout);
                return(new ViewCell {
                    View = gridLayout, Height = 40
                });
            });

            Content = new StackLayout
            {
                Margin   = new Thickness(5),
                Children =
                {
                    new ListView {
                        ItemTemplate = new PersonDataTemplateSelector{
                            StatusLabelTemplate = statusDataTemplate, TitleTemplate = titleDataTemplate, EntryTemplate = entryDataTemplate, ButtonTemplate = btntemplate
                        },
                        ItemsSource       = Test, Margin = new Thickness(0, 10, 0, 10), InputTransparent = false,
                        HasUnevenRows     = true, SeparatorVisibility = SeparatorVisibility.None,
                        HorizontalOptions = LayoutOptions.FillAndExpand, SelectionMode = ListViewSelectionMode.None,
                    }
                }
            };

            this.BindingContext = Test;
        }
Пример #10
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            CustomFrame rootFrame = Window.Current.Content as CustomFrame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new CustomFrame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing a boolean as navigation parameter,
                    // indicating whether the user is logged in or not

                    if (await AuthService.checkAuth())
                    {
                        await rootFrame.Navigate(typeof(MainPage), true);
                    }
                    else
                    {
                        await rootFrame.Navigate(typeof(MainPage), false);
                    }
                }

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
                {
                    var view = ApplicationView.GetForCurrentView();
                    view.SetPreferredMinSize(new Size(width: 800, height: 600));

                    var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    if (titleBar != null)
                    {
                        titleBar.BackgroundColor = titleBar.ButtonBackgroundColor = (Color)App.Current.Resources["SystemAltHighColor"];
                    }
                }

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    statusBar.BackgroundOpacity = 100;
                    statusBar.BackgroundColor   = (Color)Current.Resources["SystemAltHighColor"];
                }

                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Пример #11
0
 protected override void OnElementChanged(ElementChangedEventArgs <Frame> e)
 {
     base.OnElementChanged(e);
     custom = e.NewElement as CustomFrame;
 }
Пример #12
0
 public NavigationService(CustomFrame mainFrame)
 {
     _mainFrame            = mainFrame;
     _mainFrame.Navigated += OnMainFrameNavigated;
 }
Пример #13
0
 public NavigationService(CustomFrame frame)
 {
     Frame            = frame;
     Frame.Navigated += OnFrameNavigated;
 }
Пример #14
0
        void SetView()
        {
            var test = Test;

            var gridLayout = new Grid {
                RowSpacing = 10, Padding = new Thickness(0, 10, 0, 10), Margin = 10, BackgroundColor = Color.Transparent
            };

            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(2, GridUnitType.Star)
            });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(2, GridUnitType.Star)
            });

            gridLayout.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            var outerlayout = new StackLayout {
                Margin = 10
            };

            for (int i = 0; i < test.Count; i++)
            {
                var           data = test[i];
                List <string> yui  = new List <string>();
                int           l    = 0;
                foreach (string item in data.Values)
                {
                    var k = item;
                    yui.Add(k);
                    l++;
                }
                if (test[i].ContainsValue("Status_Label"))
                {
                    var layout = new StackLayout {
                        Orientation = StackOrientation.Horizontal, Margin = 10
                    };
                    var label1 = new CustomLabel {
                        HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = 130
                    };
                    var label2 = new CustomLabel {
                        HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 130, BindingKey = yui[1]
                    };
                    gridLayout.Children.Add(label1, 0, 0);
                    gridLayout.Children.Add(label2, 1, 0);
                    layout.Children.Add(label1);
                    layout.Children.Add(label2);
                    outerlayout.Children.Add(layout);
                }
                else if (test[i].ContainsValue("Title_Label"))
                {
                    var layout = new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal, Margin = 10
                    };
                    var label1 = new CustomLabel {
                        HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = 130, BindingKey = yui[1]
                    };
                    var label2 = new CustomLabel {
                        HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 130, BindingKey = yui[2]
                    };
                    gridLayout.Children.Add(label1, 0, 0);
                    gridLayout.Children.Add(label2, 1, 0);
                    layout.Children.Add(label1);
                    layout.Children.Add(label2);
                    outerlayout.Children.Add(layout);
                }
                else if (test[i].ContainsValue("Title_Entry"))
                {
                    var layout = new StackLayout {
                        Orientation = StackOrientation.Vertical, Margin = 10
                    };
                    var label = new CustomLabel {
                        HorizontalOptions = LayoutOptions.StartAndExpand, BindingKey = yui[1]
                    };
                    var entry = new CustomEditor {
                        HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.StartAndExpand,
                        HeightRequest     = 100, IsEnabled = true, Text = yui[2], BackgroundColor = Color.Transparent, RoundedCornerRadius = 20, BorderWidth = 1, BorderColor = Color.Transparent
                    };
                    var frame = new CustomFrame {
                        CornerRadius = 20, Content = entry, Padding = 0, HasShadow = true
                    };
                    gridLayout.Children.Add(label, 0, 0);
                    gridLayout.Children.Add(frame, 0, 0);
                    Grid.SetColumnSpan(frame, 2);
                    layout.Children.Add(label);
                    layout.Children.Add(frame);
                    outerlayout.Children.Add(layout);
                    Grid.SetColumnSpan(layout, 2);
                }
                else if (test[i].ContainsValue("Title_Button"))
                {
                    var layout = new StackLayout {
                        Orientation = StackOrientation.Horizontal, Margin = 10
                    };
                    var btn1 = new RoundedButtonLeft {
                        HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.StartAndExpand,
                        Text = yui[1], BackgroundColor = Color.Green, CornerRadius = 0, TextColor = Color.White
                    };
                    var btn2 = new RoundedButtonRight {
                        HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.StartAndExpand,
                        Text = yui[2], BackgroundColor = Color.Green, CornerRadius = 0, TextColor = Color.White
                    };
                    gridLayout.Children.Add(btn1, 0, 0);
                    gridLayout.Children.Add(btn2, 1, 0);
                    layout.Children.Add(btn1);
                    layout.Children.Add(btn2);
                    outerlayout.Children.Add(layout);
                }
            }
            Grid.SetColumnSpan(outerlayout, 2);
            gridLayout.Children.Add(outerlayout);
            Content = new StackLayout {
                Children = { gridLayout }
            };
        }
Пример #15
0
        internal MonoDevelopStatusBar()
        {
            BorderWidth   = 0;
            Spacing       = 0;
            HasResizeGrip = true;

            HeaderBox hb = new HeaderBox(1, 0, 0, 0);

            hb.StyleSet += (o, args) => {
                hb.BorderColor     = Styles.DockSeparatorColor.ToGdkColor();
                hb.BackgroundColor = Styles.DockBarBackground.ToGdkColor();
            };
            var mainBox = new HBox();

            mainBox.PackStart(new Label(""), true, true, 0);
            hb.Add(mainBox);
            hb.ShowAll();
            PackStart(hb, true, true, 0);

            // Feedback button

            if (FeedbackService.Enabled)
            {
                CustomFrame fr = new CustomFrame(0, 0, 1, 0);
                var         px = Xwt.Drawing.Image.FromResource("feedback-16.png");
                HBox        b  = new HBox(false, 3);
                b.PackStart(new Xwt.ImageView(px).ToGtkWidget());
                b.PackStart(new Gtk.Label("Feedback"));
                Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
                al.RightPadding = 5;
                al.LeftPadding  = 3;
                al.Add(b);
                feedbackButton = new MiniButton(al);
                //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
                fr.Add(feedbackButton);
                mainBox.PackStart(fr, false, false, 0);
                feedbackButton.Clicked          += HandleFeedbackButtonClicked;
                feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
                ;
                feedbackButton.ClickOnRelease          = true;
                FeedbackService.FeedbackPositionGetter = delegate {
                    int x, y;
                    if (feedbackButton.GdkWindow != null)
                    {
                        feedbackButton.GdkWindow.GetOrigin(out x, out y);
                        x += feedbackButton.Allocation.Width;
                        y -= 6;
                    }
                    else
                    {
                        x = y = -1;
                    }
                    return(new Gdk.Point(x, y));
                };
            }

            // Dock area

            CustomFrame dfr = new CustomFrame(0, 0, 1, 0);

            dfr.StyleSet += (o, args) => {
                dfr.BorderColor = Styles.DockSeparatorColor.ToGdkColor();
            };
            dfr.ShowAll();
            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
            var dockBar         = wb.DockFrame.ExtractDockBar(PositionType.Bottom);

            dockBar.AlignToEnd = true;
            dockBar.ShowBorder = false;
            dockBar.NoShowAll  = true;
            dfr.Add(dockBar);
            mainBox.PackStart(dfr, false, false, 0);

            // Resize grip

            resizeGrip.WidthRequest  = ResizeGripWidth;
            resizeGrip.HeightRequest = 0;
            resizeGrip.VisibleWindow = false;
            mainBox.PackStart(resizeGrip, false, false, 0);

            resizeGrip.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                if (args.Event.Button == 1)
                {
                    GdkWindow.BeginResizeDrag(Gdk.WindowEdge.SouthEast, (int)args.Event.Button, (int)args.Event.XRoot, (int)args.Event.YRoot, args.Event.Time);
                }
            };

            this.ShowAll();

//			// todo: Move this to the CompletionWindowManager when it's possible.
//			StatusBarContext completionStatus = null;
//			CompletionWindowManager.WindowShown += delegate {
//				CompletionListWindow wnd = CompletionWindowManager.Wnd;
//				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
//					if (completionStatus == null)
//						completionStatus = CreateContext ();
//					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
//				}
//			};
        }
Пример #16
0
        public void Video2X(Player player, int numberOfFrames, bool color)
        {
            Task.Run(delegate
            {
                try
                {
                    var entities = new ConcurrentDictionary <Tuple <int, int>, MapEntity[]>();

                    int width      = 6;
                    int height     = 3;
                    int frameCount = numberOfFrames;
                    //int frameOffset = 0;
                    int frameOffset = 120;

                    var frameTicker = new FrameTicker(frameCount);

                    // 768x384
                    Parallel.For(frameOffset, frameOffset + frameCount, (frame) =>
                    {
                        Log.Info($"Generating frame {frame}");

                        string file = Path.Combine(@"C:\Development\Other\Smash Heroes 3x6 (128)\Smash Heroes 3x6 (128)", $"Smash Heroes Trailer{frame:D4}.bmp");
                        //string file = Path.Combine(@"D:\Development\Other\2 by 1 PE test app ad for Gurun-2\exported frames 2", $"pe app ad{frame:D2}.bmp");
                        if (!File.Exists(file))
                        {
                            Log.Warn($"Couldn't find file: {file}");
                            return;
                        }

                        var image = new Bitmap((Bitmap)Image.FromFile(file), width * 128, height * 128);

                        for (int x = 0; x < width; x++)
                        {
                            for (int y = 0; y < height; y++)
                            {
                                var key    = new Tuple <int, int>(x, y);
                                var frames = entities.GetOrAdd(key, new MapEntity[frameCount]);

                                var croppedImage     = CropImage(image, new Rectangle(new Point(x * 128, y * 128), new Size(128, 128)));
                                byte[] bitmapToBytes = BitmapToBytes(croppedImage, color);

                                if (bitmapToBytes.Length != 128 * 128 * 4)
                                {
                                    return;
                                }

                                var entity       = new MapEntity(player.Level);
                                var cachedPacket = CreateCachedPacket(entity.EntityId, bitmapToBytes);

                                player.SendPacket(cachedPacket);
                                entity.ImageProvider = new MapImageProvider {
                                    Batch = cachedPacket
                                };
                                entity.SpawnEntity();

                                frames[frame - frameOffset] = entity;
                            }
                        }
                    });

                    //int i = 0;
                    //player.Inventory.Slots[i++] = new ItemBlock(new Planks(), 0) {Count = 64, UniqueId = Environment.TickCount};
                    //foreach (var entites in entities.Values)
                    //{
                    //	player.Inventory.Slots[i++] = new CustomItemFrame(entites.Keys.ToList(), frameTicker) {Count = 64, UniqueId = Environment.TickCount};
                    //}
                    //player.SendPlayerInventory();

                    player.SendMessage("Done generating video.", MessageType.Raw);

                    BlockCoordinates center = player.KnownPosition.GetCoordinates3D();
                    var level = player.Level;

                    for (int x = 0; x < width; x++)
                    {
                        for (int y = 0; y < height; y++)
                        {
                            var key    = new Tuple <int, int>(x, y);
                            var frames = new List <MapEntity>(entities[key]);
                            frames     = frames.Where(f => f != null).ToList();

                            var bc   = new BlockCoordinates(center.X - x, center.Y + height - y - 1, center.Z + 2);
                            var wood = new Planks {
                                Coordinates = bc
                            };
                            level.SetBlock(wood);

                            var frambc = new BlockCoordinates(center.X - x, center.Y + height - y - 1, center.Z + 1);
                            var itemFrameBlockEntity = new ItemFrameBlockEntity {
                                Coordinates = frambc
                            };

                            var itemFrame = new CustomFrame(frames, itemFrameBlockEntity, level, frameTicker)
                            {
                                Coordinates     = frambc,
                                FacingDirection = (int)BlockFace.North
                            };
                            level.SetBlock(itemFrame);
                            level.SetBlockEntity(itemFrameBlockEntity);
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error("Aborted video generation", e);
                }
            });

            player.SendMessage("Generating video...", MessageType.Raw);
        }
Пример #17
0
        internal MonoDevelopStatusBar()
        {
            BorderWidth   = 0;
            Spacing       = 0;
            HasResizeGrip = true;

            HeaderBox hb = new HeaderBox(1, 0, 0, 0);

            hb.BorderColor = Styles.DockSeparatorColor;
            var mainBox = new HBox();

            mainBox.PackStart(new Label(""), true, true, 0);
            hb.Add(mainBox);
            hb.ShowAll();
            PackStart(hb, true, true, 0);

            // Feedback button

            if (FeedbackService.Enabled)
            {
                CustomFrame fr = new CustomFrame(0, 0, 1, 1);
                Gdk.Pixbuf  px = Gdk.Pixbuf.LoadFromResource("balloon.png");
                HBox        b  = new HBox(false, 3);
                b.PackStart(new Gtk.Image(px));
                b.PackStart(new Gtk.Label("Feedback"));
                Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
                al.RightPadding = 5;
                al.LeftPadding  = 3;
                al.Add(b);
                feedbackButton = new MiniButton(al);
                //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
                fr.Add(feedbackButton);
                mainBox.PackStart(fr, false, false, 0);
                feedbackButton.Clicked          += HandleFeedbackButtonClicked;
                feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
                ;
                feedbackButton.ClickOnRelease          = true;
                FeedbackService.FeedbackPositionGetter = delegate {
                    int x, y;
                    feedbackButton.GdkWindow.GetOrigin(out x, out y);
                    x += feedbackButton.Allocation.Width;
                    y -= 6;
                    return(new Gdk.Point(x, y));
                };
            }

            // Dock area

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
            var dockBar         = wb.DockFrame.ExtractDockBar(PositionType.Bottom);

            dockBar.AlignToEnd = true;
            dockBar.ShowBorder = false;
            dockBar.NoShowAll  = true;
            mainBox.PackStart(dockBar, false, false, 0);

            // Resize grip

            resizeGrip.WidthRequest  = ResizeGripWidth;
            resizeGrip.HeightRequest = 0;
            mainBox.PackStart(resizeGrip, false, false, 0);

            // Status panels

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);
            statusLabel.ShowAll();

            messageBox.PackStart(statusLabel, true, true, 0);

            var eventCaretBox  = new EventBox();
            var caretStatusBox = new HBox();

            modeLabel = new Label(" ");
            caretStatusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new CaretStatusLabel(" ");
            caretStatusBox.PackEnd(cursorLabel, false, false, 0);

            caretStatusBox.GetSizeRequest(out w, out h);
            caretStatusBox.WidthRequest  = w;
            caretStatusBox.HeightRequest = h;
            eventCaretBox.Add(caretStatusBox);
            statusBox.PackEnd(eventCaretBox, false, false, 0);

            this.ShowAll();

//			// todo: Move this to the CompletionWindowManager when it's possible.
//			StatusBarContext completionStatus = null;
//			CompletionWindowManager.WindowShown += delegate {
//				CompletionListWindow wnd = CompletionWindowManager.Wnd;
//				if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
//					if (completionStatus == null)
//						completionStatus = CreateContext ();
//					completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
//				}
//			};
        }
        public void CreateView()
        {
            var gridLayout = new Grid {
                RowSpacing = 10, Padding = new Thickness(0, 10, 0, 10), Margin = 10
            };

            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(2, GridUnitType.Star)
            });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(2, GridUnitType.Star)
            });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });

            gridLayout.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            var outerlayout = new StackLayout {
                HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start
            };


            StackLayout         innerlayout = null;
            int                 count       = list.Count;
            var                 amp         = list;
            int                 colmCounter = 0;
            KeyToValueConverter keyToValue  = new KeyToValueConverter();

            var product = amp[0];

            for (int i = 0; i < product.Count; i++)
            {
                if (i % 2 == 0)
                {
                    innerlayout = new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };
                    outerlayout.Children.Add(innerlayout);
                    colmCounter = 0;
                }

                object jj = null;
                if (product[i].ContainsValue("Label"))
                {
                    var x = product[i];

                    foreach (var item in x)
                    {
                        if (!item.Value.Equals("Label"))
                        {
                            jj = item.Value;
                        }
                    }

                    var label = new CustomLabel
                    {
                        Text            = "dummy" + i.ToString(),
                        FontSize        = 15,
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        Index           = i.ToString(),
                        BindingKey      = (string)jj,
                        WidthRequest    = 100,
                        Margin          = new Thickness(10, 0, 0, 0)
                    };

                    if (colmCounter % 2 == 0)
                    {
                        label.HorizontalOptions = LayoutOptions.Start;
                    }
                    else
                    {
                        label.HorizontalOptions = LayoutOptions.CenterAndExpand;
                        // label.Margin = new Thickness(10, 0, 0, 0);
                    }


                    //var test = label.BindingKey;
                    //object t1 = new object();
                    //t1 = test;
                    //  var test = x;
                    object t1 = new object();
                    t1 = i;
                    // t1 = test;


                    label.SetBinding(CustomLabel.BindingKeyProperty, new Binding(".", BindingMode.TwoWay,
                                                                                 new KeyToValueConverter(), t1, null,
                                                                                 this.BindingContext));

                    // label.SetBinding(Label.TextProperty, ".",BindingMode.Default,null);


                    gridLayout.Children.Add(label, colmCounter, 1);
                    innerlayout.Children.Add(label);
                    Grid.SetColumnSpan(outerlayout, 2);
                    colmCounter++;
                }
            }

            gridLayout.Children.Add(outerlayout);

            View = new CustomFrame
            {
                Content           = gridLayout,
                CornerRadius      = 10,
                HasShadow         = true,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                Margin            = new Thickness(10, 5, 10, 5),
                Padding           = 0,
                BorderColor       = Color.Gray,
            };
            // View.HeightRequest = 150;
            this.View.Margin = 5;
        }