private NWidget CreateLoanCalculator()
        {
            NStackPanel stack = new NStackPanel();

            stack.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10);
            stack.HorizontalPlacement = ENHorizontalPlacement.Left;
            stack.VerticalSpacing     = NDesign.VerticalSpacing * 2;

            NLabel titleLabel = new NLabel(NLoc.Get("Loan Calculator"));

            titleLabel.Font          = new NFont(NFontDescriptor.DefaultSansFamilyName, 16);
            titleLabel.Margins       = new NMargins(0, 0, 0, NDesign.VerticalSpacing);
            titleLabel.TextAlignment = ENContentAlignment.MiddleCenter;
            stack.Add(titleLabel);

            m_AmountUpDown               = new NNumericUpDown();
            m_AmountUpDown.Value         = 10000;
            m_AmountUpDown.Step          = 500;
            m_AmountUpDown.ValueChanged += OnUpDownValueChanged;
            stack.Add(NPairBox.Create(NLoc.Get("Amount:"), m_AmountUpDown));

            m_TermUpDown               = new NNumericUpDown();
            m_TermUpDown.Value         = 8;
            m_TermUpDown.ValueChanged += OnUpDownValueChanged;
            stack.Add(NPairBox.Create(NLoc.Get("Term in years:"), m_TermUpDown));

            m_RateUpDown               = new NNumericUpDown();
            m_RateUpDown.Value         = 5;
            m_RateUpDown.Step          = 0.1;
            m_RateUpDown.DecimalPlaces = 2;
            m_RateUpDown.ValueChanged += OnUpDownValueChanged;
            stack.Add(NPairBox.Create(NLoc.Get("Interest rate per year (%):"), m_RateUpDown));

            // Create the results labels
            NLabel repaymentLabel = new NLabel(NLoc.Get("Repayment Summary"));

            repaymentLabel.Margins       = new NMargins(0, NDesign.VerticalSpacing * 5, 0, 0);
            repaymentLabel.Font          = new NFont(NFontDescriptor.DefaultSansFamilyName, 12, ENFontStyle.Underline);
            repaymentLabel.TextAlignment = ENContentAlignment.MiddleCenter;
            stack.Add(repaymentLabel);

            m_MonthlyPaymentLabel = new NLabel();
            m_MonthlyPaymentLabel.TextAlignment = ENContentAlignment.MiddleRight;
            stack.Add(NPairBox.Create(NLoc.Get("Monthly Payment:"), m_MonthlyPaymentLabel));

            m_TotalPaymentsLabel = new NLabel();
            m_TotalPaymentsLabel.TextAlignment = ENContentAlignment.MiddleRight;
            stack.Add(NPairBox.Create(NLoc.Get("Total Payments:"), m_TotalPaymentsLabel));

            m_TotalInterestLabel = new NLabel();
            m_TotalInterestLabel.TextAlignment = ENContentAlignment.MiddleRight;
            stack.Add(NPairBox.Create(NLoc.Get("Total Interest:"), m_TotalInterestLabel));

            CalculateResult();

            return(new NUniSizeBoxGroup(stack));
        }
示例#2
0
        public override void Initialize()
        {
            base.Initialize();

            // Add the custom command action to the rich text view's commander
            m_RichText.Commander.Add(new CustomCommandAction());

            // Remove the "Edit" menu and insert a custom one
            m_CommandBarBuilder = new NRichTextCommandBarBuilder();
            m_CommandBarBuilder.MenuDropDownBuilders.Remove(NLoc.Get("Edit"));
            m_CommandBarBuilder.MenuDropDownBuilders.Insert(1, new CustomMenuBuilder());

            // Remove the "Standard" toolbar and insert a custom one
            m_CommandBarBuilder.ToolBarBuilders.Remove(NLoc.Get("Standard"));
            m_CommandBarBuilder.ToolBarBuilders.Insert(0, new CustomToolBarBuilder());

            // Remove the rich text view from its parent and recreate the command bar UI
            m_RichText.ParentNode.RemoveChild(m_RichText);
            m_ExampleTabPage.Content = m_CommandBarBuilder.CreateUI(m_RichText);
        }
        protected override void InitSchedule(NSchedule schedule)
        {
            // Rename the first predefined category
            schedule.Categories[0].Name = NLoc.Get("Renamed Category");

            // Create and add some custom categories
            NCategory category1 = new NCategory(NLoc.Get("Custom Category 1"), NColor.Khaki);

            schedule.Categories.Add(category1);

            NCategory category2 = new NCategory(NLoc.Get("Custom Category 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange));

            schedule.Categories.Add(category2);

            // Remove the second category
            schedule.Categories.RemoveAt(1);

            // Remove the category called "Green"
            NCategory categoryToRemove = schedule.Categories.FindByName(NLoc.Get("Green"));

            if (categoryToRemove != null)
            {
                schedule.Categories.Remove(categoryToRemove);
            }

            // Create and add some appointments
            DateTime start = DateTime.Now;

            NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2));

            appointment1.Category = category1.Name;
            schedule.Appointments.Add(appointment1);

            NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5));

            appointment2.Category = category2.Name;
            schedule.Appointments.Add(appointment2);

            // Scroll the schedule to the start of the first appointment
            schedule.ScrollToTime(start.TimeOfDay);
        }
示例#4
0
        protected override void InitSchedule(NSchedule schedule)
        {
            // Rename the first predefined time marker
            schedule.TimeMarkers[0].Name = NLoc.Get("Renamed Time Marker");

            // Create and add some custom time markers
            NTimeMarker timeMarker1 = new NTimeMarker(NLoc.Get("Custom Time Marker 1"), NColor.Khaki);

            schedule.TimeMarkers.Add(timeMarker1);

            NTimeMarker timeMarker2 = new NTimeMarker(NLoc.Get("Custom Time Marker 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange));

            schedule.TimeMarkers.Add(timeMarker2);

            // Remove the second time marker
            schedule.TimeMarkers.RemoveAt(1);

            // Remove the time marker called "Busy"
            NTimeMarker timeMarkerToRemove = schedule.TimeMarkers.FindByName(NLoc.Get("Busy"));

            if (timeMarkerToRemove != null)
            {
                schedule.TimeMarkers.Remove(timeMarkerToRemove);
            }

            // Create and add some appointments
            DateTime start = DateTime.Now;

            NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2));

            appointment1.TimeMarker = timeMarker1.Name;
            schedule.Appointments.Add(appointment1);

            NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5));

            appointment2.TimeMarker = timeMarker2.Name;
            schedule.Appointments.Add(appointment2);

            // Scroll the schedule to the start of the first appointment
            schedule.ScrollToTime(start.TimeOfDay);
        }
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime start = DateTime.Now;

            // Replace the default Add Appointment command action with a custom one
            NCommandAction addAppointmentCommandAction = m_ScheduleView.Commander.GetCommandAction(NScheduleView.AddAppointmentCommand);

            m_ScheduleView.Commander.Remove(addAppointmentCommandAction);
            m_ScheduleView.Commander.Add(new CustomAddAppointmentCommandAction());

            // Replace the default Appointment Edit tool with a custom one
            NTool appointmentEditTool = m_ScheduleView.Interactor.GetTool(NAppointmentEditTool.NAppointmentEditToolSchema);
            int   index = m_ScheduleView.Interactor.IndexOf(appointmentEditTool);

            m_ScheduleView.Interactor.RemoveAt(index);

            NTool customEditAppointmentTool = new CustomAppointmentEditTool();

            customEditAppointmentTool.Enabled = true;
            m_ScheduleView.Interactor.Insert(index, customEditAppointmentTool);

            // Create some custom appointments
            AppointmentWithLocation appointmentWithLocation = new AppointmentWithLocation(
                "Appointment with Location", start, start.AddHours(2));

            appointmentWithLocation.Location = "New York";
            schedule.Appointments.Add(appointmentWithLocation);

            AppointmentWithImage appointmentWithImage = new AppointmentWithImage(
                "Appointment with Image", start.AddHours(3), start.AddHours(5));

            appointmentWithImage.Image    = NResources.Image_MobileComputers_UMPC_jpg;
            appointmentWithImage.Category = NLoc.Get("Orange");
            schedule.Appointments.Add(appointmentWithImage);

            schedule.ScrollToTime(start.TimeOfDay);
        }