Ejemplo n.º 1
0
        /// <summary>
        /// Populates all controls on the form.
        /// </summary>
        private void PopulateForm()
        {
            listmodel.Clear();
            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            if (version.Major == 0)
            {
                label1.Text = "You are currently using a custom build of APSIM. You cannot upgrade this to a newer version.";
            }
            else
            {
                try
                {
                    PopulateUpgradeList();
                }
                catch (Exception)
                {
                    MasterView.ShowMsgDialog("Cannot download the upgrade list.\nEither the server is down or your network connection is broken.", "Error", MessageType.Error, ButtonsType.Ok, window1);
                    loadFailure = true;
                    return;
                }
                if (upgrades.Length > 0)
                {
                    label1.Text = "You are currently using version " + version.ToString() + ". Newer versions are listed below.";
                    label1.Text = label1.Text + Environment.NewLine + "Select an upgrade below.";
                }
                else
                {
                    label1.Text = "You are currently using version " + version.ToString() + ". You are using the latest version.";
                }
            }

            firstNameBox.Text    = Utility.Configuration.Settings.FirstName;
            lastNameBox.Text     = Utility.Configuration.Settings.LastName;
            organisationBox.Text = Utility.Configuration.Settings.Organisation;
            address1Box.Text     = Utility.Configuration.Settings.Address1;
            address2Box.Text     = Utility.Configuration.Settings.Address2;
            cityBox.Text         = Utility.Configuration.Settings.City;
            stateBox.Text        = Utility.Configuration.Settings.State;
            postcodeBox.Text     = Utility.Configuration.Settings.Postcode;
            countryBox.Text      = Utility.Configuration.Settings.Country;
            emailBox.Text        = Utility.Configuration.Settings.Email;

            WebClient web = new WebClient();

            string tempLicenseFileName = Path.Combine(Path.GetTempPath(), "APSIM_NonCommercial_RD_licence.htm");

            if (File.Exists(tempLicenseFileName))
            {
                File.Delete(tempLicenseFileName);
            }

            try
            {
                // web.DownloadFile(@"https://www.apsim.info/APSIM.Registration.Portal/APSIM_NonCommercial_RD_licence.htm", tempLicenseFileName);
                // HTMLview.SetContents(File.ReadAllText(tempLicenseFileName), false, true);
                HTMLview.SetContents(@"https://www.apsim.info/APSIM.Registration.Portal/APSIM_NonCommercial_RD_licence.htm", false, true);
            }
            catch (Exception)
            {
                ViewBase.MasterView.ShowMsgDialog("Cannot download the license.", "Error", MessageType.Error, ButtonsType.Ok, window1);
                loadFailure = true;
            }
        }
Ejemplo n.º 2
0
 public Master( MasterView masterView )
 {
     this.masterView = masterView;
 }
Ejemplo n.º 3
0
        protected virtual void CreateMenuPage(string menuPageTitle, string menuIcon = null)
        {
            _masterView = new MasterView();
            _listView   = _masterView.FindByName <ListView>("ListView");

            var source = Pages.GroupBy(item => item.Group).Select(item => new Grouping <string, LazyLoadedPage>(item.Key, item.ToList())).ToList();

            _listView.ItemTapped += (sender, args) =>
            {
                var lazyLoadedPage = args.Item as LazyLoadedPage;

                if (Pages.Contains(lazyLoadedPage))
                {
                    Page page          = lazyLoadedPage.Page;
                    int  tabGroupIndex = lazyLoadedPage.TabGroupIndex;

                    if (page == null)
                    {
                        page = ResolvePage(lazyLoadedPage);
                    }

                    Detail = page;

                    if (tabGroupIndex > 0)
                    {
                        var tabbedNavigationPage = new FreshTabbedNavigationContainer();

                        switch (tabGroupIndex)
                        {
                        case 1:
                            tabbedNavigationPage.AddTab <ContactListViewModel>("Contacts 1", "Icon.png");
                            tabbedNavigationPage.AddTab <BlankViewModel>("Contacts 2", "Icon.png");
                            tabbedNavigationPage.AddTab <BlankViewModel>("Contacts 3", "Icon.png");
                            Detail = tabbedNavigationPage;
                            break;

                        case 2:
                            tabbedNavigationPage.AddTab <TabViewModel>("Tab 1", "Icon.png");
                            tabbedNavigationPage.AddTab <BlankViewModel>("Tab 2", "Icon.png");
                            Detail = tabbedNavigationPage;
                            break;
                        }
                    }
                }

                IsPresented = false;
            };

            var navPage = new NavigationPage(_masterView)
            {
                Title = menuPageTitle
            };

            //adding an actual icon does't seem to work. The unicode here is a temporarily solution

            if (!string.IsNullOrEmpty(menuIcon))
            {
                navPage.Icon = menuIcon;
                Icon         = menuIcon;
            }

            Master = navPage;
        }
Ejemplo n.º 4
0
        public static void Update(/*GameTime gameTime*/)
        {
            if (ModUtils.NetworkMode != NetworkMode.Server)
            {
                ModUtils.PreviousKeyboardState = Main.keyState;
                ModUtils.PreviousMouseState    = ModUtils.MouseState;
                ModUtils.MouseState            = Mouse.GetState();

                ModUtils.SetDeltaTime(/*gameTime*/);
                ModUtils.Update();
                //HEROsModVideo.Services.MobHUD.MobInfo.Update();
                //CheckIfGameEnteredOrLeft();
                //Update all services in the ServiceController
                foreach (var service in ServiceController.Services)
                {
                    service.Update();
                }
                MasterView.UpdateMaster();
                SelectionTool.Update();
                //if (Main.ingameOptionsWindow && (IngameOptions.category == 2 || IngameOptions.category == 3))
                //{
                //	HEROsModMod.UIKit.MasterView.gameScreen.AddChild(new HEROsModMod.UIKit.UIComponents.KeybindWindow());
                //	IngameOptions.Close();
                //}

                // This is the alternate tooltip code.
                //if (!Main.gameMenu)
                //{
                //	ModUtils.ItemTooltip.Update();
                //}

                // Unused 3D code

                //float speed = .03f;
                //if (Main.keyState.IsKeyDown(Keys.Left))
                //{
                //	angle -= speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Right))
                //{
                //	angle += speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Up))
                //{
                //	angle2 -= speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Down))
                //{
                //	angle2 += speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.X))
                //{
                //	zoom += speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Z))
                //{
                //	zoom -= speed;

                //}


                //Matrix worldMatrix = Matrix.Identity
                //	* Matrix.CreateTranslation(new Vector3(-Main.screenWidth / 2, -Main.screenHeight / 2, 0f))
                //	* Matrix.CreateRotationX(angle2)
                //	* Matrix.CreateRotationY(angle)
                //	* Matrix.CreateTranslation(new Vector3(Main.screenWidth / 2 / zoom, Main.screenHeight / 2 / zoom, 0f))
                //	* Matrix.CreateScale(zoom);

                //   ModUtils.TextureExtruder.WorldView = worldMatrix;
            }
            HEROsModNetwork.Network.Update();
            //	HEROsModNetwork.CTF.CaptureTheFlag.Update();
        }
 public EventedViewController()
 {
     _masterView = new MasterView();
 }
Ejemplo n.º 6
0
 private void CancelButton_Click(object sender, EventArgs e)
 {
     MasterView.Close();
 }
Ejemplo n.º 7
0
 public void ReloadMasterObject()
 {
     AllScrapeData = MasterView.GetMasterView();
 }
Ejemplo n.º 8
0
 /// <summary>Populate the context menu from the descriptions passed in.</summary>
 /// <param name="menuDescriptions">Menu descriptions for each menu item.</param>
 public void PopulateContextMenu(List <MenuDescriptionArgs> menuDescriptions)
 {
     ClearPopup();
     foreach (MenuDescriptionArgs description in menuDescriptions)
     {
         MenuItem item;
         if (description.ShowCheckbox)
         {
             CheckMenuItem checkItem = new CheckMenuItem(description.Name);
             checkItem.Active = description.Checked;
             item             = checkItem;
         }
         else if (!String.IsNullOrEmpty(description.ResourceNameForImage) && MasterView.HasResource(description.ResourceNameForImage))
         {
             ImageMenuItem imageItem = new ImageMenuItem(description.Name);
             imageItem.Image = new Image(null, description.ResourceNameForImage);
             item            = imageItem;
         }
         else
         {
             item = new MenuItem(description.Name);
         }
         if (!String.IsNullOrEmpty(description.ShortcutKey))
         {
             string           keyName  = String.Empty;
             Gdk.ModifierType modifier = Gdk.ModifierType.None;
             string[]         keyNames = description.ShortcutKey.Split(new Char[] { '+' });
             foreach (string name in keyNames)
             {
                 if (name == "Ctrl")
                 {
                     modifier |= Gdk.ModifierType.ControlMask;
                 }
                 else if (name == "Shift")
                 {
                     modifier |= Gdk.ModifierType.ShiftMask;
                 }
                 else if (name == "Alt")
                 {
                     modifier |= Gdk.ModifierType.Mod1Mask;
                 }
                 else if (name == "Del")
                 {
                     keyName = "Delete";
                 }
                 else
                 {
                     keyName = name;
                 }
             }
             try
             {
                 Gdk.Key accelKey = (Gdk.Key)Enum.Parse(typeof(Gdk.Key), keyName, false);
                 item.AddAccelerator("activate", accel, (uint)accelKey, modifier, AccelFlags.Visible);
             }
             catch
             {
             }
         }
         item.Activated += description.OnClick;
         popup.Append(item);
     }
     if (popup.AttachWidget == null)
     {
         popup.AttachToWidget(Listview, null);
     }
     popup.ShowAll();
 }
Ejemplo n.º 9
0
        void Submit(object obj)
        {
            string password            = (obj as PasswordBox).Password;
            var    validate            = new DataValidations.DataValidation();
            var    constants           = new Constants();
            var    validateCompanyData = new CompanyValidations();

            if (UserName == Constants.usernamedMaster && SecurePasswordHasher.Verify(password, constants.passwordEmployeeHashed))
            {
                MasterView masterView = new MasterView();
                loginView.Close();
                masterView.Show();
                return;
            }

            else if (validateCompanyData.IsCorrectUser(userName, password))
            {
                var db         = new CompanyDBRepository();
                int userDataId = db.GetUserDataId(userName);
                if (userDataId != 0)
                {
                    var typeOfUser = validateCompanyData.GetUserType(userDataId);
                    if (typeOfUser == nameof(tblManager))
                    {
                        var notImplemented = new NotImplemntedView();
                        notImplemented.Show();
                        loginView.Close();
                        return;
                    }
                    if (typeOfUser == nameof(tblAdministrator))
                    {
                        var typeOfAdministrator = validateCompanyData.GetAdministratorType(userDataId);
                        if (typeOfAdministrator == "System")
                        {
                            AdministratorView administrator = new AdministratorView(typeOfAdministrator);
                            administrator.Show();
                            loginView.Close();
                            return;
                        }
                        else
                        {
                            var notImplemented = new NotImplemntedView();
                            notImplemented.Show();
                            loginView.Close();
                            return;
                        }
                    }
                    if (typeOfUser == nameof(tblEmployee))
                    {
                        var notImplemented = new NotImplemntedView();
                        notImplemented.Show();
                        loginView.Close();
                        return;
                    }
                }
            }
            else
            {
                WarningView warning = new WarningView(loginView);
                warning.Show("User name or password are not correct!");
                return;
            }
        }
Ejemplo n.º 10
0
        /// <summary>Initializes a new instance of the <see cref="SeriesView" /> class</summary>
        public SeriesView(ViewBase owner) : base(owner)
        {
            Builder builder = MasterView.BuilderFromResource("ApsimNG.Resources.Glade.SeriesView.glade");

            vbox1       = (VBox)builder.GetObject("vbox1");
            table1      = (Table)builder.GetObject("table1");
            label4      = (Label)builder.GetObject("label4");
            label5      = (Label)builder.GetObject("label5");
            _mainWidget = vbox1;

            graphView1 = new GraphView(this);
            vbox1.PackStart(graphView1.MainWidget, true, true, 0);

            checkpointDropDown    = new DropDownView(this);
            dataSourceDropDown    = new DropDownView(this);
            xDropDown             = new DropDownView(this);
            yDropDown             = new DropDownView(this);
            x2DropDown            = new DropDownView(this);
            y2DropDown            = new DropDownView(this);
            seriesDropDown        = new DropDownView(this);
            lineTypeDropDown      = new DropDownView(this);
            markerTypeDropDown    = new DropDownView(this);
            colourDropDown        = new ColourDropDownView(this);
            lineThicknessDropDown = new DropDownView(this);
            markerSizeDropDown    = new DropDownView(this);

            checkBoxView1             = new CheckBoxView(this);
            checkBoxView1.TextOfLabel = "on top?";
            checkBoxView2             = new CheckBoxView(this);
            checkBoxView2.TextOfLabel = "on right?";
            checkBoxView3             = new CheckBoxView(this);
            checkBoxView3.TextOfLabel = "cumulative?";
            checkBoxView4             = new CheckBoxView(this);
            checkBoxView4.TextOfLabel = "cumulative?";
            checkBoxView5             = new CheckBoxView(this);
            checkBoxView5.TextOfLabel = "Show in legend?";
            checkBoxView6             = new CheckBoxView(this);
            checkBoxView6.TextOfLabel = "Include series name in legend?";

            editView1 = new EditView(this);

            table1.Attach(checkpointDropDown.MainWidget, 1, 2, 0, 1, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dataSourceDropDown.MainWidget, 1, 2, 1, 2, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(xDropDown.MainWidget, 1, 2, 2, 3, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(yDropDown.MainWidget, 1, 2, 3, 4, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(y2DropDown.MainWidget, 1, 2, 4, 5, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(x2DropDown.MainWidget, 1, 2, 5, 6, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(seriesDropDown.MainWidget, 1, 2, 6, 7, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(lineTypeDropDown.MainWidget, 1, 2, 7, 8, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(markerTypeDropDown.MainWidget, 1, 2, 8, 9, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(colourDropDown.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);

            Image    helpImage = new Image(null, "ApsimNG.Resources.help.png");
            EventBox ebHelp    = new EventBox();

            ebHelp.Add(helpImage);
            ebHelp.ButtonPressEvent += Help_ButtonPressEvent;
            HBox filterBox = new HBox();

            filterBox.PackStart(editView1.MainWidget, true, true, 0);
            filterBox.PackEnd(ebHelp, false, true, 0);

            //table1.Attach(editView1.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(filterBox, 1, 2, 10, 11, AttachOptions.Fill, 0, 10, 2);

            table1.Attach(checkBoxView1.MainWidget, 2, 3, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView2.MainWidget, 2, 3, 3, 4, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView3.MainWidget, 3, 4, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView4.MainWidget, 3, 4, 3, 4, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(checkBoxView5.MainWidget, 2, 4, 9, 10, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView6.MainWidget, 2, 4, 10, 11, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(lineThicknessDropDown.MainWidget, 3, 4, 7, 8, AttachOptions.Fill, 0, 0, 5);
            table1.Attach(markerSizeDropDown.MainWidget, 3, 4, 8, 9, AttachOptions.Fill, 0, 0, 5);
            _mainWidget.Destroyed += _mainWidget_Destroyed;
        }
Ejemplo n.º 11
0
 public MasterDetailPage()
 {
     masterView = new MasterView <T>(SetActiveItem);
     detailView = new DetailView <T>();
 }