Пример #1
0
        internal ToolTipViewModel(ToolTipModel toolTip)
        {
            IsOpen = toolTip
                     .ObserveProperty(x => x.IsOpen)
                     .ToReadOnlyReactivePropertySlim()
                     .AddTo(disposable);

            Title = toolTip
                    .ObserveProperty(x => x.Title)
                    .ToReadOnlyReactivePropertySlim()
                    .AddTo(disposable);

            Icon = toolTip
                   .ObserveProperty(x => x.Icon)
                   .ToReadOnlyReactivePropertySlim()
                   .AddTo(disposable);

            Text = toolTip
                   .ObserveProperty(x => x.Text)
                   .ToReadOnlyReactivePropertySlim()
                   .AddTo(disposable);

            X = toolTip
                .ObserveProperty(x => x.X)
                .ToReadOnlyReactivePropertySlim()
                .AddTo(disposable);

            Y = toolTip
                .ObserveProperty(x => x.Y)
                .ToReadOnlyReactivePropertySlim()
                .AddTo(disposable);
        }
Пример #2
0
        public ServerList()
        {
            this.ToolTipModel = new ObservableCollection <ServerInfoModel>();
            DateTime dt = new DateTime(2012, 1, 1);

            ToolTipModel.Add(new ServerInfoModel()
            {
                Id = 0, Day = dt, Server1Perf = 20, Server2Perf = 50
            });
            ToolTipModel.Add(new ServerInfoModel()
            {
                Id = 1, Day = dt.AddMonths(1), Server1Perf = 40, Server2Perf = 60
            });
            ToolTipModel.Add(new ServerInfoModel()
            {
                Id = 2, Day = dt.AddMonths(2), Server1Perf = 80, Server2Perf = 60
            });
            ToolTipModel.Add(new ServerInfoModel()
            {
                Id = 3, Day = dt.AddMonths(3), Server1Perf = 70, Server2Perf = 40
            });
            ToolTipModel.Add(new ServerInfoModel()
            {
                Id = 4, Day = dt.AddMonths(4), Server1Perf = 50, Server2Perf = 90
            });
            ToolTipModel.Add(new ServerInfoModel()
            {
                Id = 5, Day = dt.AddMonths(5), Server1Perf = 60, Server2Perf = 80
            });
        }
Пример #3
0
        private void Submit_Click(object sender, EventArgs e)
        {
            double amount = 0;

            // If this value remaines fales then a feild was invalid.
            bool valid = false;

            try
            {
                // Parse the amount as a double
                amount = double.Parse(amountTextBox.Text);

                // Check that the description is not empty but is also less than the maximum length of the description.
                if (amount <= 0)
                {
                    var ttm = new ToolTipModel("Error", "Amounts must be positive and greater than zero.", (amountTextBox));
                    toolTipHandler.Draw(ttm);
                }
                else if (descriptionTextBox.Equals(""))
                {
                    var ttm = new ToolTipModel("Error", "Please input a description.", descriptionTextBox);
                    toolTipHandler.Draw(ttm);
                }
                else
                {
                    valid = true;
                }
            }
            catch (Exception ex)
            {
                // Must not be a valid double value.
                Console.WriteLine(ex);
                var ttm = new ToolTipModel("Error", "Please input a valid monetary value.", amountTextBox);
                toolTipHandler.Draw(ttm);
            }

            // If all the fields are valid.
            if (valid)
            {
                if (moneyOut)
                {
                    amount *= -1;
                }

                using (var model = controller.Database())
                {
                    var transaction = new Transaction(date.Value, CleanDescription(), amount);

                    model.Transactions.Add(transaction);
                }

                controller.RefreshViews();

                Console.WriteLine("Data Sent");

                // Close this window
                Close();
            }
        }
Пример #4
0
        private void DisplayUpdateTransactionToolTip(object sender, EventArgs e)
        {
            var ttm = new ToolTipModel(
                "Updating Transactions",
                "Press ENTER to save your changes.",
                (sender as RichTextBox)
                );

            _toolTipHandler.Draw(ttm);
        }
Пример #5
0
        public object Clone()
        {
            Motor motor = (Motor)MemberwiseClone();

            motor.MessageBox      = new MessageBox();
            ToolTipVertexPitch    = new ToolTipModel();
            ToolTipVertexVolume   = new ToolTipModel();
            motor.previewArea     = null;
            motor.selectedRange   = null;
            motor.Tracks          = new ObservableCollection <Track>(Tracks.Select(x => (Track)x.Clone()));
            motor.PrevTrackStates = new ObservableCollection <TrackState>(PrevTrackStates.Select(x => (TrackState)x.Clone()));
            motor.NextTrackStates = new ObservableCollection <TrackState>(NextTrackStates.Select(x => (TrackState)x.Clone()));
            return(motor);
        }
Пример #6
0
        public void Notify(Core.Type type, Priority priority, string message)
        {
            string heading;

            switch (type)
            {
            case Core.Type.Error: heading = "Error"; break;

            case Core.Type.Notification: heading = "Notification"; break;

            case Core.Type.Warning: heading = "Warning"; break;

            default: heading = string.Empty; break;
            }

            var ttm = new ToolTipModel(heading, message, this);

            _toolTipHandler.Draw(ttm);
        }
Пример #7
0
        internal Motor()
        {
            culture = CultureInfo.InvariantCulture;

            MessageBox          = new MessageBox();
            ToolTipVertexPitch  = new ToolTipModel();
            ToolTipVertexVolume = new ToolTipModel();
            CurrentCursorType   = InputEventModel.CursorType.Arrow;

            Tracks = new ObservableCollection <Track>();

            for (int i = 0; i < 4; i++)
            {
                Tracks.Add(new Track());
            }

            SelectedTrackInfo  = TrackInfo.Power1;
            SelectedSoundIndex = -1;

            PrevTrackStates = new ObservableCollection <TrackState>();
            NextTrackStates = new ObservableCollection <TrackState>();

            MinVelocity = 0.0;
            MaxVelocity = 40.0;

            MinPitch = 0.0;
            MaxPitch = 400.0;

            MinVolume = 0.0;
            MaxVolume = 256.0;

            CurrentSimState = SimulationState.Stopped;
            RunIndex        = -1;
            IsPlayTrack1    = IsPlayTrack2 = true;
            Acceleration    = 2.6;
            StartSpeed      = 0.0;
            EndSpeed        = 160.0;

            GlControlWidth  = 568;
            GlControlHeight = 593;
        }
        private void submit_Click(object sender, EventArgs e)
        {
            try
            {
                // If the user has inputted a monthly allowance that is different to the current one.
                if (oldAllowanceBox.Text.Equals(newAllowanceBox.Text))
                {
                    var ttm = new ToolTipModel(
                        "Error",
                        "Allowance is unchanged. Please enter a new allowance or 'Cancel'.",
                        newAllowanceBox
                        );

                    // Feedback to user.
                    toolTipHandler.Draw(ttm);

                    return;
                }

                // If the user has not left the new monthly allowance text box empty.
                if ((newAllowanceBox.Text.Equals(string.Empty)))
                {
                    var ttm = new ToolTipModel(
                        "Error",
                        "No new Allowance specified. Please enter a new allowance or 'Cancel'.",
                        newAllowanceBox
                        );

                    // Feedback to user.
                    toolTipHandler.Draw(ttm);

                    return;
                }
                // Parse the new monthly allowance as a double value.
                double newBudget = double.Parse(newAllowanceBox.Text);

                // If the monthly allowance is greater than zero.
                if (newBudget <= 0)
                {
                    var ttm = new ToolTipModel(
                        "Error",
                        "New Monthly allowance must be greater than zero.",
                        newAllowanceBox

                        );

                    // Feedback to user.
                    toolTipHandler.Draw(ttm);
                    return;
                }

                using (var model = controller.Database()) {
                    var existingBudget = model.Budgets.Find(month.Value);

                    if (existingBudget == null)
                    {
                        var budget = new Budget(month.Value, newBudget);
                        model.Budgets.Add(budget);
                    }
                    else
                    {
                        existingBudget.Amount = newBudget;
                        model.SaveChanges();
                    }
                }

                controller.RefreshViews();

                Dispose();
            }
            catch (Exception ex)
            {
                var ttm = new ToolTipModel("Error", ex.Message, newAllowanceBox);
                // Feedback to user.
                toolTipHandler.Draw(ttm);
            }
        }
        private void showRecommendToolTip(object sender, EventArgs e)
        {
            var ttm = new ToolTipModel("Recommend", "Unavailable", recommendButton);

            toolTipHandler.Draw(ttm);
        }
        private void showAmountToolTip(object sender, EventArgs e)
        {
            var ttm = new ToolTipModel("Input Allowance", "Input a new monthly allowance for the selected month.", newAllowanceBox);

            toolTipHandler.Draw(ttm);
        }
Пример #11
0
        private void ShowDescriptionToolTip(object sender, EventArgs e)
        {
            var ttm = new ToolTipModel("Input Description", "Input a descrition for the transaction. Less than 50 characters.", descriptionTextBox);

            toolTipHandler.Draw(ttm);
        }
Пример #12
0
        private void ShowAmountToolTip(object sender, EventArgs e)
        {
            var ttm = new ToolTipModel("Input Amount", "Input the amount of money in the transaction.", amountTextBox);

            toolTipHandler.Draw(ttm);
        }
Пример #13
0
        private void ShowToggleToolTip(object sender, EventArgs e)
        {
            var ttm = new ToolTipModel("Toggling Income/Outcome", "Click here to toggle whether the transaction is Income or Outcome.", (sender as Button));

            toolTipHandler.Draw(ttm);
        }
Пример #14
0
        private void DisplaySuccessUpdatedFieldToolTip(RichTextBox sender)
        {
            var ttm = new ToolTipModel("Success", "Your changes have been saved.", sender);

            _toolTipHandler.Draw(ttm);
        }
Пример #15
0
        private void DisplayFailUpdatedFieldToolTip(RichTextBox sender, string errorMessage)
        {
            var ttm = new ToolTipModel("Failure", errorMessage, sender);

            _toolTipHandler.Draw(ttm);
        }