//*************************************************************************
    //  Constructor: RunSetVisualAttributeCommandEventArgs()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="RunSetVisualAttributeCommandEventArgs" /> class.
    /// </summary>
    ///
    /// <param name="visualAttribute">
    /// Specifies the visual attribute to set.  Must be only one of the flags
    /// in the <see cref="VisualAttributes" /> enumeration; it cannot be an
    /// ORed combination.
    /// </param>
    ///
    /// <param name="attributeValue">
    /// The visual attribute value, or null if the value isn't known yet and
    /// must be obtained from the user.
    /// </param>
    //*************************************************************************

    public RunSetVisualAttributeCommandEventArgs
    (
        VisualAttributes visualAttribute,
        Object attributeValue
    )
    {
        m_eVisualAttribute = visualAttribute;
        m_oAttributeValue = attributeValue;
        m_bVisualAttributeSet = false;

        AssertValid();
    }
Exemplo n.º 2
0
        //*************************************************************************
        //  Constructor: SetVisualAttributeEventArgs()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="SetVisualAttributeEventArgs" /> class.
        /// </summary>
        ///
        /// <param name="visualAttribute">
        /// Specifies the visual attribute to set.  Must be only one of the flags
        /// in the <see cref="VisualAttributes" /> enumeration; it cannot be an
        /// ORed combination.
        /// </param>
        ///
        /// <param name="attributeValue">
        /// The visual attribute value, or null if the value isn't known yet and
        /// must be obtained from the user.
        /// </param>
        //*************************************************************************

        public SetVisualAttributeEventArgs
        (
            VisualAttributes visualAttribute,
            Object attributeValue
        )
        {
            m_eVisualAttribute    = visualAttribute;
            m_oAttributeValue     = attributeValue;
            m_bVisualAttributeSet = false;

            AssertValid();
        }
        /// <summary>
        /// Create UI layout that will be displayed at the top of the ListView
        /// </summary>
        /// <returns>RelativeLayout</returns>
        private RelativeLayout CreateListViewHeader()
        {
            // The View for Header of ListView
            RelativeLayout headerLayout = new RelativeLayout
            {
                HeightRequest = 93
            };

            // Title label of ListView's header
            Label headerTitleLabel = new Label()
            {
                HorizontalOptions     = LayoutOptions.FillAndExpand,
                VerticalTextAlignment = TextAlignment.Center,
                Text      = "Select all",
                TextColor = Color.Black,
                FontSize  = 20,
            };

            // to meet To meet thin attribute for font, need to use custom feature
            FontFormat.SetFontWeight(headerTitleLabel, FontWeight.Light);
            headerLayout.Children.Add(headerTitleLabel,
                                      Constraint.RelativeToParent((parent) =>
            {
                return(32 + 10);
            }),
                                      Constraint.RelativeToParent((parent) =>
            {
                return(22 + 93 - 72);
            }));

            // Switch to give an app user an opportunity to delete all data items of List
            deleteAllSwitch = new Switch
            {
                HorizontalOptions = LayoutOptions.End,
            };
            VisualAttributes.SetThemeStyle(deleteAllSwitch, "CheckBox");
            deleteAllSwitch.Toggled += DeleteAllSwitch_Toggled;
            headerLayout.Children.Add(deleteAllSwitch,
                                      Constraint.RelativeToParent((parent) =>
            {
                return(720 - 104);
            }),
                                      Constraint.RelativeToParent((parent) =>
            {
                return(22 + 93 - 72);
            }));
            return(headerLayout);
        }
        /// <summary>
        /// Create Start/Pause/Cancel/Reset/Resume Buttons
        /// </summary>
        void CreateMenuButtons()
        {
            startButton = new Button
            {
                Style = CommonStyle.oneButtonStyle,
                Text  = "Start",
            };
            VisualAttributes.SetThemeStyle(startButton, "bottom");
            SetEnabledStartButton(false);
            startButton.Clicked += OnStartButtonClicked;

            pauseButton = new Button
            {
                Style     = CommonStyle.twoButtonStyle,
                Text      = "Pause",
                IsVisible = false,
            };
            VisualAttributes.SetThemeStyle(pauseButton, "bottom");
            pauseButton.Clicked += OnPauseButtonClicked;

            cancelButton = new Button
            {
                Style     = CommonStyle.twoButtonStyle,
                Text      = "Cancel",
                IsVisible = false,
            };
            VisualAttributes.SetThemeStyle(cancelButton, "bottom");
            cancelButton.Clicked += OnCancelButtonClicked;

            resetButton = new Button
            {
                Style     = CommonStyle.twoButtonStyle,
                Text      = "Reset",
                IsVisible = false,
            };
            VisualAttributes.SetThemeStyle(resetButton, "bottom");
            resetButton.Clicked += OnResetButtonClicked;

            resumeButton = new Button
            {
                Style     = CommonStyle.twoButtonStyle,
                Text      = "Resume",
                IsVisible = false,
            };
            VisualAttributes.SetThemeStyle(resumeButton, "bottom");
            resumeButton.Clicked += OnResumeButtonClicked;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public WorldclockCityListDeleteCell() : base()
        {
            // Resizing labels for adding Switch to listview's itemTemplate
            AdjustSize();

            // Add CheckBox to WorldclockCityListCell
            CheckBoxSwitch = new Switch()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };
            VisualAttributes.SetThemeStyle(CheckBoxSwitch, "CheckBox");
            CheckBoxSwitch.SetBinding(Switch.IsToggledProperty, new Binding("Delete", BindingMode.TwoWay));
            CheckBoxSwitch.Toggled += ItemSwitch_Toggled;
            cityListItemLayout.Children.Add(CheckBoxSwitch,
                                            Constraint.RelativeToParent((parent) =>
            {
                return(720 - 104);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(22 + 93 - 72);
            }));
        }
        // Construct alarm list cell's UI
        protected override RelativeLayout Draw()
        {
            RelativeLayout alarmItemDeleteLayout = base.Draw();

            switchObj.IsVisible = false;
            CheckBoxSwitch      = new Switch()
            {
                HeightRequest = 72,
                WidthRequest  = 72,
            };
            VisualAttributes.SetThemeStyle(CheckBoxSwitch, "CheckBox");
            CheckBoxSwitch.SetBinding(Switch.IsToggledProperty, new Binding("Delete", BindingMode.TwoWay));
            CheckBoxSwitch.Toggled += ItemSwitch_Toggled;
            alarmItemLayout.Children.Add(CheckBoxSwitch,
                                         Constraint.RelativeToParent((parent) =>
            {
                return(720 - 104);
            }),
                                         Constraint.RelativeToParent((parent) =>
            {
                return(22 + 93 - 72);
            }));
            return(alarmItemDeleteLayout);
        }
Exemplo n.º 7
0
        //*************************************************************************
        //  Method: EnableSetVisualAttributes
        //
        /// <summary>
        /// Enables the "set visual attribute" buttons.
        /// </summary>
        ///
        /// <param name="visualAttributes">
        /// ORed flags specifying which buttons to enable.
        /// </param>
        //*************************************************************************
        public void EnableSetVisualAttributes(
            VisualAttributes visualAttributes
            )
        {
            AssertValid();

            this.btnSetColor.Enabled =
            ( (visualAttributes & VisualAttributes.Color) != 0 );

            this.btnSetAlpha.Enabled =
            ( (visualAttributes & VisualAttributes.Alpha) != 0 );

            this.btnSetEdgeWidth.Enabled =
            ( (visualAttributes & VisualAttributes.EdgeWidth) != 0 );

            this.mnuSetVertexShape.Enabled =
            ( (visualAttributes & VisualAttributes.VertexShape) != 0 );

            this.btnSetVertexRadius.Enabled =
            ( (visualAttributes & VisualAttributes.VertexRadius) != 0 );

            // The mnuSetVisibility menu has a set of child buttons for edge
            // visibility and another set for vertex visibility.  Show only one
            // of the sets.

            Boolean bShowSetEdgeVisibility =
            ( (visualAttributes & VisualAttributes.EdgeVisibility) != 0 );

            Boolean bShowSetVertexVisibility =
            ( (visualAttributes & VisualAttributes.VertexVisibility) != 0 );

            this.mnuSetVisibility.Enabled =
            (bShowSetEdgeVisibility || bShowSetVertexVisibility);

            this.btnSetEdgeVisibilityShow.Visible =
            this.btnSetEdgeVisibilitySkip.Visible =
            this.btnSetEdgeVisibilityHide.Visible =
            bShowSetEdgeVisibility;

            this.btnSetVertexVisibilityShowIfInAnEdge.Visible =
            this.btnSetVertexVisibilitySkip.Visible =
            this.btnSetVertexVisibilityHide.Visible =
            this.btnSetVertexVisibilityShow.Visible =
            bShowSetVertexVisibility;
        }
        /// <summary>
        /// Create the stopwatch main page.
        /// </summary>
        /// <returns> The StackLayout. </returns>
        private StackLayout CreateStopWatchPage()
        {
            if (mainView == null)
            {
                counterview = new CounterView(CounterType.COUNTER_TYPE_STOPWATCH);
                rLayout     = counterview.GetCounterLayout();

                listItems = new LapListObservableCollection();

                // Create the start button
                startButton = new Button
                {
                    Style = CommonStyle.oneButtonStyle,
                    Text  = "Start",
                };
                VisualAttributes.SetThemeStyle(startButton, "bottom");
                startButton.Clicked += StartButton_Clicked;

                // Create the stop button
                stopButton = new Button
                {
                    Style     = CommonStyle.twoButtonStyle,
                    Text      = "Stop",
                    IsVisible = false,
                };
                VisualAttributes.SetThemeStyle(stopButton, "bottom");
                stopButton.Clicked += StopButton_Clicked;

                // Create the lap button
                lapButton = new Button
                {
                    Style     = CommonStyle.twoButtonStyle,
                    Text      = "Lap",
                    IsVisible = false,
                };
                VisualAttributes.SetThemeStyle(lapButton, "bottom");
                lapButton.Clicked += LapButton_Clicked;

                // Create the layout to place start button
                StackLayout bsLayout = new StackLayout
                {
                    HeightRequest     = 150,
                    Spacing           = 0,
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.End,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        startButton,
                        stopButton,
                        lapButton
                    }
                };

                // Create the main view
                mainView = new StackLayout
                {
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Spacing           = 0,
                    //BackgroundColor = Color.Red,
                    Children =
                    {
                        rLayout,
                        bsLayout
                    }
                };
            }

            return(mainView);
        }
Exemplo n.º 9
0
        //*************************************************************************
        //  Method: SetVisualAttribute()
        //
        /// <summary>
        /// Sets one visual attribute that gets stored in the workbook.
        /// </summary>
        ///
        /// <param name="visualAttribute">
        /// Specifies the visual attribute to set.  Must be only one of the flags
        /// in the <see cref="VisualAttributes" /> enumeration; it cannot be an
        /// ORed combination.
        /// </param>
        ///
        /// <param name="attributeValue">
        /// The visual attribute value, or null if the value isn't known yet and
        /// must be obtained from the user.
        /// </param>
        ///
        /// <remarks>
        /// If the specified visual attribute is a graph-level attribute (such as
        /// VisualAttribute.GraphBackground), the visual attribute value gets
        /// stored in the workbook's per-workbook settings.  Otherwise, the visual
        /// attribute value gets stored in the selected rows of the active
        /// worksheet.
        /// </remarks>
        //*************************************************************************
        public void SetVisualAttribute(
            VisualAttributes visualAttribute,
            Object attributeValue
            )
        {
            AssertValid();

            if ( !this.ExcelApplicationIsReady(true) )
            {
            return;
            }

            if (visualAttribute == VisualAttributes.GraphBackground)
            {
            BackgroundDialog oBackgroundDialog = new BackgroundDialog(
                this.PerWorkbookSettings);

            if (oBackgroundDialog.ShowDialog() == DialogResult.OK)
            {
                FireVisualAttributeSetInWorkbook();
            }
            }
            else
            {
            SetVisualAttributeEventHandler oSetVisualAttributeEventHandler =
                this.SetVisualAttribute2;

            if (oSetVisualAttributeEventHandler != null)
            {
                SetVisualAttributeEventArgs oSetVisualAttributeEventArgs =
                    new SetVisualAttributeEventArgs(visualAttribute,
                        attributeValue);

                oSetVisualAttributeEventHandler(this,
                    oSetVisualAttributeEventArgs);

                if (oSetVisualAttributeEventArgs.VisualAttributeSet)
                {
                    FireVisualAttributeSetInWorkbook();
                }
            }
            }
        }