示例#1
0
 /// <summary>
 ///
 /// </summary>
 protected override void ViewClosing(FormClosingEventArgs e)
 {
     if (modified)
     {
         e.Cancel = UIBridge.BooleanDecision("Save changes?");
     }
 }
 public AddDepartments()
 {
     InitializeComponent();
     bridge = (UIBridge)Application.Current.Resources["bridge"];
     Show();
     RefreshDepartmentComboBox();
 }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        partial void saveButtonClick(EventArgs e)
        {
            if (fileLoaded == String.Empty)
            {
                //first we get a filename
                using (var fileDialog = new SaveFileDialog())
                {
                    fileDialog.Filter           = "MVCMAP Files|*.mvcmap";
                    fileDialog.InitialDirectory = Environment.CurrentDirectory;
                    fileDialog.OverwritePrompt  = true;
                    fileDialog.Title            = "Save file as...";
                    if (fileDialog.ShowDialog() == DialogResult.OK)
                    {
                        fileLoaded = fileDialog.FileName;
                    }
                    else
                    {
                        UIBridge.Alert("File save aborted");
                    }
                }
            }

            //we just overwrite... should this be an option?

            ViewActionMap.Save(data, fileLoaded, true);

            modified = false;
        }
 public AdminForm()
 {
     InitializeComponent();
     bridge = (UIBridge)Application.Current.Resources["bridge"];
     Show();
     allVacations = bridge.GetUnapprovedVacations();
     populateListBoxes();
 }
 public AddEmployees()
 {
     InitializeComponent();
     bridge = (UIBridge)Application.Current.Resources["bridge"];
     Show();
     RefreshDepartmentComboBox();
     RefreshAllPersonnelComboBox();
 }
示例#6
0
 public EmployeeForm()
 {
     InitializeComponent();
     bridge = (UIBridge)Application.Current.Resources["bridge"];
     Show();
     Start.SelectedDate = DateTime.Today.AddDays(1);
     End.SelectedDate   = DateTime.Today.AddDays(1);
     GetBlackoutDates();
     AvailableVacationDays.Content = DisplayAvailableVacationDays();
 }
 partial void button1Click(EventArgs e)
 {
     if (Core.ValidateAccountNumber(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text)) == ValidationResult.Valid)
     {
         UIBridge.Alert("Valid");
     }
     else
     {
         UIBridge.Alert("Invalid");
     }
 }
示例#8
0
        public EmployeeMenu()
        {
            InitializeComponent();
            bridge = (UIBridge)Application.Current.Resources["bridge"];
            string vacationDate = bridge.GetNextVacationDateStart();

            NextVacationBox.Text = vacationDate;
            //System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            //dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            //dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            //dispatcherTimer.Start();
            Show();
        }
示例#9
0
 public Login()
 {
     InitializeComponent();
     Application.Current.Resources["bridge"] = new UIBridge();
     bridge = (UIBridge)Application.Current.Resources["bridge"];
     if (CheckForAdmins())
     {
         Show();
     }
     else
     {
         Close();
     }
 }
示例#10
0
 public AdminMenu()
 {
     InitializeComponent();
     bridge = (UIBridge)Application.Current.Resources["bridge"];
     Show();
 }
示例#11
0
 public AllBridges(AllExecutableObjects listExecutableObjects)
 {
     var uiBridge     = new UIBridge(listExecutableObjects);
     var dataBridge   = new DataBridge(listExecutableObjects, uiBridge.HealthBar);
     var eventsBridge = new EventsBridge(listExecutableObjects);
 }
示例#12
0
        private void LoadClassData()
        {
            var registeredTypes = new List <Store>();

            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            foreach (Assembly a in assemblies)
            {
                foreach (Type t in a.GetExportedTypes())
                {
                    // Ignore type if not a public class
                    if (!t.IsClass || !t.IsPublic)
                    {
                        continue;
                    }

                    //skip non controls
                    if (!(t == typeof(Control) || t.IsSubclassOf(typeof(Control))) && !(t == typeof(Component) || t.IsSubclassOf(typeof(Component))))
                    {
                        continue;
                    }

                    //register the type...
                    try
                    {
                        if (registeredTypes.Where(x => x.ClassName == t.FullName).Count() <= 0)
                        {
                            registeredTypes.Add(new Store()
                            {
                                ClassName = t.Name, ClassType = t
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(String.Format("{0} - {1}", ex.GetType().Name, ex.Message));
                        System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                    }
                }
            }

            //find the control
            var control = registeredTypes.Where(x => x.ClassName == controlName).SingleOrDefault();

            if (control != null)
            {
                EventInfo[] eia = control.ClassType.GetEvents();

                eventCombo.BeginUpdate();
                eventCombo.DataSource = null;

                foreach (var ei in eia)
                {
                    //get the event name

                    ParameterInfo[] epia = ei.EventHandlerType.GetMethod("Invoke").GetParameters();

                    string eventarg = String.Empty;

                    if (epia != null)
                    {
                        foreach (var pi in epia)
                        {
                            if (pi.ParameterType == typeof(EventArgs) || pi.ParameterType.IsSubclassOf(typeof(EventArgs)))
                            {
                                eventarg = pi.ParameterType.FullName; //because we otherwise get a lot of issues building stuff when the class is not in the standard System.Windows.Forms namespace

                                //System.Console.WriteLine(ei.Name + " : " + ei.EventHandlerType + " :: " + "" + eventarg);
                                actions.Add(new Tools.ViewAction()
                                {
                                    EventName = ei.Name, EventHandlerName = ei.EventHandlerType.FullName, EventArgsName = eventarg
                                });

                                break;
                            }
                        }
                    }
                }
                eventCombo.DataSource    = actions;
                eventCombo.DisplayMember = "EventName";
                eventCombo.EndUpdate();
            }
            else
            {
                UIBridge.Alert("Control was not found!");
                View.DialogResult = DialogResult.Cancel;
                View.Close();
            }
        }