Ejemplo n.º 1
0
        private void btnImportCatalogues_Click(object sender, EventArgs e)
        {
            GovernancePeriod[] toImportFrom = Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <GovernancePeriod>()
                                              .Where(gov => gov.ID != _governancePeriod.ID)
                                              .ToArray();

            if (!toImportFrom.Any())
            {
                MessageBox.Show("You do not have any other GovernancePeriods in your Catalogue");
                return;
            }

            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, toImportFrom, false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                ICatalogue[] toAdd = ((GovernancePeriod)dialog.Selected).GovernedCatalogues.ToArray();

                //do not add any we already have
                toAdd = toAdd.Except(olvCatalogues.Objects.Cast <Catalogue>()).ToArray();

                if (!toAdd.Any())
                {
                    MessageBox.Show("Selected GovernancePeriod '" + dialog.Selected +
                                    "' does not govern any novel Catalogues (Catalogues already in your configuration are not repeat imported)");
                }
                else
                {
                    AddCatalogues(toAdd);

                    Publish(_governancePeriod);
                }
            }
        }
Ejemplo n.º 2
0
        public override IMapsDirectlyToDatabaseTable[] SelectMany(DialogArgs args, Type arrayElementType,
                                                                  IMapsDirectlyToDatabaseTable[] availableObjects)
        {
            if (!availableObjects.Any())
            {
                MessageBox.Show("There are no '" + arrayElementType.Name + "' objects in your RMDP");
                return(null);
            }

            var selectDialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(args, this, availableObjects, false, false);

            selectDialog.AllowMultiSelect = true;

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                var ms       = selectDialog.MultiSelected.ToList();
                var toReturn = Array.CreateInstance(arrayElementType, ms.Count);

                for (int i = 0; i < ms.Count; i++)
                {
                    toReturn.SetValue(ms[i], i);
                }

                return(toReturn.Cast <IMapsDirectlyToDatabaseTable>().ToArray());
            }

            return(null);
        }
Ejemplo n.º 3
0
        private void btnPickDatabaseEntities_Click(object sender, EventArgs e)
        {
            var type        = _args.Type;
            var elementType = type.GetElementType();

            if (elementType == null)
            {
                throw new NotSupportedException("No array element existed for DemandsInitialization Type " + type);
            }

            if (!_args.CatalogueRepository.SupportsObjectType(elementType))
            {
                throw new NotSupportedException("CatalogueRepository does not support element " + elementType + " for DemandsInitialization Type " + type);
            }

            var objects = _args.CatalogueRepository.GetAllObjects(elementType);
            var dialog  = new SelectDialog <IMapsDirectlyToDatabaseTable>(_activator, objects, true, false);

            dialog.AllowMultiSelect = true;

            if (_value is IEnumerable <IMapsDirectlyToDatabaseTable> v)
            {
                dialog.SetInitialSelection(v);
            }

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var result = dialog.MultiSelected == null ? null : dialog.MultiSelected.ToArray();
                _args.Setter(result);
                SetUp(result);
            }
        }
Ejemplo n.º 4
0
        public override void Execute()
        {
            base.Execute();
            var ses = session;

            if (ses == null)
            {
                var sessions = Activator.GetSessions().ToArray();

                if (sessions.Length == 1)
                {
                    ses = sessions[0];
                }
                else
                {
                    var dlg = new SelectDialog <SessionCollectionUI>(BasicActivator, sessions, false, false);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        ses = dlg.Selected;
                    }
                }
            }

            if (ses == null)
            {
                return;
            }
            ses.Add(_toAdd);
        }
Ejemplo n.º 5
0
        private void btnAddExtractableDatasetPackage_Click(object sender, EventArgs e)
        {
            var dataExportChildProvider = _activator.CoreChildProvider as DataExportChildProvider;

            if (dataExportChildProvider == null)
            {
                return;
            }

            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, dataExportChildProvider.AllPackages, false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var packageToAdd = (ExtractableDataSetPackage)dialog.Selected;

                var contents = _activator.RepositoryLocator.DataExportRepository.PackageManager.GetAllDataSets(packageToAdd, dataExportChildProvider.ExtractableDataSets);

                foreach (var cata in contents.Select(ds => ds.Catalogue))
                {
                    if (!_collection.GetCatalogues().Contains(cata))
                    {
                        AddCatalogue((Catalogue)cata);
                    }
                }

                SaveCollectionChanges();
                GenerateChart();
            }
        }
Ejemplo n.º 6
0
        public override IMapsDirectlyToDatabaseTable SelectOne(DialogArgs args, IMapsDirectlyToDatabaseTable[] availableObjects)
        {
            if (!availableObjects.Any())
            {
                MessageBox.Show($"There are no compatible objects in your RMDP for:{Environment.NewLine}{args}");
                return(null);
            }

            //if there is only one object available to select
            if (availableObjects.Length == 1)
            {
                if (args.AllowAutoSelect)
                {
                    return(availableObjects[0]);
                }
            }

            var selectDialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(args, this, availableObjects, false, false);

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                return(selectDialog.Selected);
            }

            return(null); //user didn't select one of the IMapsDirectlyToDatabaseTable objects shown in the dialog
        }
Ejemplo n.º 7
0
        private void btnChooseRightTableInfo_Click(object sender, EventArgs e)
        {
            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, _leftTableInfo.Repository.GetAllObjects <TableInfo>().Where(t => t.ID != _leftTableInfo.ID), false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                SetRightTableInfo((TableInfo)dialog.Selected);
            }
        }
Ejemplo n.º 8
0
        private void btnExisting_Click(object sender, EventArgs e)
        {
            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, Activator.RepositoryLocator.DataExportRepository.GetAllObjects <Project>(), false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                SetProject((Project)dialog.Selected);
            }
        }
        private void lPick_Click(object sender, System.EventArgs e)
        {
            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(_activator, _available.Cast <IMapsDirectlyToDatabaseTable>(), false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                suggestComboBox1.SelectedItem = dialog.Selected;
            }
        }
Ejemplo n.º 10
0
        private void btnBillNo_Click(object sender, EventArgs e)
        {
            DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", string.Format("TaskType='11' and AreaCode='{0}'",AreaCode)) });

            SelectDialog selectDialog = new SelectDialog(dt, BillFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtBillNo.Text = selectDialog["BillID"];
            }
        }
Ejemplo n.º 11
0
        private void btnState_Click(object sender, EventArgs e)
        {
            DataTable    dt           = bll.FillDataTable("CMD.SelectProductState");
            SelectDialog selectDialog = new SelectDialog(dt, StateFields, false);

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtStateNo.Text = selectDialog["StateNo"];
            }
        }
Ejemplo n.º 12
0
        private void btnTaskID_Click(object sender, EventArgs e)
        {
            DataTable dt = bll.FillDataTable("WCS.SelectTask", new DataParameter[] { new DataParameter("{0}", string.Format("WCS_TASK.TaskType='11' and WCS_TASK.CellCode='{0}'", CellCode)) });

            SelectDialog selectDialog = new SelectDialog(dt, TaskFields, false);

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtTaskNo.Text = selectDialog["TaskNo"];
            }
        }
Ejemplo n.º 13
0
        private void lblPickPivotColumn_Click(object sender, EventArgs e)
        {
            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, _catalogue.GetAllExtractionInformation(ExtractionCategory.Any), true, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var ei = dialog.Selected as ExtractionInformation;
                cbxPivotColumn.SelectedItem = ei;
                SetPivot(ei);
            }
        }
Ejemplo n.º 14
0
        private void btnProductCode_Click(object sender, EventArgs e)
        {
            DataTable dt = bll.FillDataTable("CMD.SelectProduct", new DataParameter[] { new DataParameter("{0}", "IsProduce='1'") });

            SelectDialog selectDialog = new SelectDialog(dt, ProductFields, false);

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtProductCode.Text = selectDialog["ProductCode"];
                this.txtProductName.Text = selectDialog["ProductName"];
            }
        }
Ejemplo n.º 15
0
        private void btnBillNo_Click(object sender, EventArgs e)
        {
            DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", string.Format("TaskType='11' and AreaCode='{0}'", AreaCode)) });


            SelectDialog selectDialog = new SelectDialog(dt, BillFields, false);

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtBillNo.Text = selectDialog["BillID"];
            }
        }
Ejemplo n.º 16
0
        private void btnPick_Click(object sender, EventArgs e)
        {
            var available = cbxCatalogues.Items.OfType <Catalogue>();
            var dialog    = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, available, false, false);

            dialog.AllowMultiSelect = true;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                SetCatalogueSelection(dialog.MultiSelected.OfType <ICatalogue>().ToArray());
            }
        }
Ejemplo n.º 17
0
        private void NewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dlg = new SelectDialog <IAtomicCommand>(Activator, GetNewCommands(), false, false);

            dlg.Text = "Create New:";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                var picked = dlg.Selected;
                picked.Execute();
            }
        }
Ejemplo n.º 18
0
        public override bool SelectEnum(DialogArgs args, Type enumType, out Enum chosen)
        {
            var selector = new SelectDialog <Enum>(args, this, Enum.GetValues(enumType).Cast <Enum>().ToArray(), false, false);

            if (selector.ShowDialog() == DialogResult.OK)
            {
                chosen = selector.Selected;
                return(true);
            }

            chosen = default;
            return(false);
        }
        public string SelectDialog(string message, string title, List <string> items)
        {
            var dialog = new SelectDialog(title, message, items);

            if (dialog.ShowDialog() == true)
            {
                return(dialog.Input);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 20
0
        public override bool SelectObject <T>(DialogArgs args, T[] available, out T selected)
        {
            var pick = new SelectDialog <T>(args, this, available, false, false);

            if (pick.ShowDialog() == DialogResult.OK)
            {
                selected = pick.Selected;
                return(true);
            }

            selected = default(T);
            return(false);
        }
Ejemplo n.º 21
0
        public override bool SelectType(DialogArgs args, Type[] available, out Type chosen)
        {
            var dlg = new SelectDialog <Type>(args, this, available, false, false);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                chosen = dlg.Selected;
                return(true);
            }


            chosen = null;
            return(false);
        }
Ejemplo n.º 22
0
        static bool ShowProgramOptions(string filename, Lcd lcd, Buttons btns)
        {
            string runString        = "Run Program";
            string runInDebugString = "Debug Program";
            string deleteString     = "Delete Program";
            var    dialog           = new SelectDialog <string> (Font.MediumFont, lcd, btns, new string[] {
                runString,
                runInDebugString,
                deleteString
            }, "Options", true);

            dialog.Show();
            if (!dialog.EscPressed)
            {
                string selection = dialog.GetSelection();
                if (selection == runString)
                {
                    lcd.Clear();
                    lcd.DrawBitmap(monoLogo, new Point((int)(Lcd.Width - monoLogo.Width) / 2, 5));
                    Rectangle textRect = new Rectangle(new Point(0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point(Lcd.Width, Lcd.Height - 2));
                    lcd.WriteTextBox(Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
                    lcd.Update();
                    MenuAction = () => RunAndWaitForProgram(filename, false);
                }
                if (selection == runInDebugString)
                {
                    MenuAction = () => RunAndWaitForProgram(filename, true);
                }
                if (selection == deleteString)
                {
                    var infoDialog = new InfoDialog(font, lcd, btns, "Deleting File. Please wait", false, "Deleting File");
                    infoDialog.Show();
                    if (ProcessHelper.RunAndWaitForProcess("rm", filename) == 0)
                    {
                        infoDialog = new InfoDialog(font, lcd, btns, "Program deleted", true, "Deleting File");
                    }
                    else
                    {
                        infoDialog = new InfoDialog(font, lcd, btns, "Error deleting program", true, "Deleting File");
                    }
                    infoDialog.Show();
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 23
0
        private void btnViewDataTable_Click(object sender, EventArgs e)
        {
            var navigateTo = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, GetCatalogueItems().Where(ci => string.IsNullOrWhiteSpace(ci.Description)), false, false);

            navigateTo.Show();

            navigateTo.Closed += (o, args) =>
            {
                if (navigateTo.DialogResult == DialogResult.OK)
                {
                    var cmd = new ExecuteCommandShow(Activator, navigateTo.Selected, 1);
                    cmd.Execute();
                }
            };
        }
Ejemplo n.º 24
0
        public override bool SelectObjects <T>(DialogArgs args, T[] available, out T[] selected)
        {
            var pick = new SelectDialog <T>(args, this, available, false, false);

            pick.AllowMultiSelect = true;

            if (pick.ShowDialog() == DialogResult.OK)
            {
                selected = pick.MultiSelected.ToArray();
                return(true);
            }

            selected = default(T[]);
            return(false);
        }
Ejemplo n.º 25
0
        public async Task AddUsers()
        {
            using (var context = new NeoTrackerContext())
            {
                try
                {
                    var list = context.Users.Where(x => !context.DepartmentUsers.Any(y => y.DepartmentID == DepartmentID && y.UserID == x.UserID)).ToList().Select(x => new DropdownItem()
                    {
                        Value = x.UserID,
                        Text  = x.LongName
                    }).OrderBy(x => x.Text).ToList();

                    if (list.Any())
                    {
                        App.vm.SelectItemList = list;
                        var dialog = new SelectDialog("Select users");
                        dialog.ShowDialog();

                        if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                        {
                            var result = App.vm.SelectItemList.Where(x => x.IsSelected).ToList();

                            if (result.Any())
                            {
                                foreach (var item in result)
                                {
                                    context.DepartmentUsers.Add(new DepartmentUser()
                                    {
                                        DepartmentID = DepartmentID,
                                        UserID       = item.Value
                                    });
                                }
                                await context.SaveChangesAsync();
                                await LoadUsers();
                            }
                        }
                    }
                    else
                    {
                        App.vm.UserMsg = "No users to add!!!";
                    }
                }
                catch (Exception e)
                {
                    App.vm.UserMsg = e.Message.ToString();
                }
            }
        }
Ejemplo n.º 26
0
        private void CreateMissingClassMenuItem_Click(object sender, EventArgs e)
        {
            if (this.SystemImplementation == null)
            {
                return;
            }

            List <Definitions.Description.Global> globals = new List <Definitions.Description.Global>();

            foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols)
            {
                globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalClass)));
            }

            SelectDialog <Definitions.Description.Global> dlg = new SelectDialog <Definitions.Description.Global>();

            dlg.CheckBoxes = true;
            dlg.Items      = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name);
            dlg.Columns    = new SelectDialogColumn <Definitions.Description.Global>[] {
                new SelectDialogColumn <Definitions.Description.Global>("Global", 200, (g => g.Name)),
                new SelectDialogColumn <Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name))
            };

            if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK)
            {
                return;
            }

            foreach (var g in dlg.SelectedItems)
            {
                Class cls = new Class(this.SystemImplementation);
                cls.Name           = g.Name;
                cls.SuperclassName = "Object";
                cls.Description    = g.Description;
                cls.ImplementedClassProtocols.Add(g.Protocol.Name);
                cls.Initializer.Source = g.Initializer;
                cls.InstanceState      = InstanceStateEnum.NamedObjectVariables;
                cls.DefiningProtocol   = g.Protocol.Name;



                if (!this.SystemImplementation.GlobalItems.Contains(cls))
                {
                    this.SystemImplementation.GlobalItems.Add(cls);
                }
            }
            this.SystemImplementation.GlobalItems.TriggerChanged();
        }
Ejemplo n.º 27
0
        private void btnFolder_Click(object sender, EventArgs e)
        {
            var folders = Activator.CoreChildProvider.GetAllChildrenRecursively(CatalogueFolder.Root).OfType <CatalogueFolder>().ToList();

            folders.Add(CatalogueFolder.Root);

            var dlg = new SelectDialog <CatalogueFolder>(Activator, folders.ToArray(), false, false);

            dlg.Text = "Generate For Folder";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                SetCatalogueSelection(Activator.CoreChildProvider.GetAllChildrenRecursively(dlg.Selected)
                                      .OfType <ICatalogue>().ToArray());
            }
        }
Ejemplo n.º 28
0
        private void btnSingleCatalogue_Click(object sender, EventArgs e)
        {
            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(), false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var c = (Catalogue)dialog.Selected;
                _collection.SetSingleCatalogueMode(c);

                btnAllCatalogues.Checked   = false;
                btnSingleCatalogue.Checked = true;

                SaveCollectionChanges();
                GenerateChart();
            }
        }
Ejemplo n.º 29
0
        private void btnPickProject_Click(object sender, EventArgs e)
        {
            if (_projectSpecific != null)
            {
                SelectProject(null);
            }
            else
            {
                var all    = Activator.RepositoryLocator.DataExportRepository.GetAllObjects <Project>();
                var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(Activator, all, false, false);

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    SelectProject((Project)dialog.Selected);
                }
            }
        }
Ejemplo n.º 30
0
        private void UseExisting(object sender, EventArgs e)
        {
            var dialog = new SelectDialog <IMapsDirectlyToDatabaseTable>(_activator, _availableServers, false, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var selected = (ExternalDatabaseServer)dialog.Selected;

                if (selected != null)
                {
                    _tableInfo.IdentifierDumpServer_ID = selected.ID;
                    _tableInfo.SaveToDatabase();

                    _activator.RefreshBus.Publish(this, new RefreshObjectEventArgs((TableInfo)_tableInfo));
                }
            }
        }
Ejemplo n.º 31
0
        /// <summary>显示语言下载对话框</summary>
        /// <returns>返回值为是否下载了语言文件</returns>
        public static bool ShowLanguageDialog()
        {
            string      apiUrl = AppConfig.RequestUseGithub ? GithubLangsApi : GiteeLangsApi;
            XmlDocument doc    = GetWebJsonToXml(apiUrl);

            if (doc == null)
            {
                MessageBoxEx.Show(AppString.Message.WebDataReadFailed);
                return(false);
            }
            XmlNodeList list = doc.FirstChild.ChildNodes;

            string[] langs = new string[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                XmlNode nameXN = list.Item(i).SelectSingleNode("name");
                langs[i] = Path.GetFileNameWithoutExtension(nameXN.InnerText);
            }
            using (SelectDialog dlg = new SelectDialog())
            {
                dlg.Items = langs;
                dlg.Title = AppString.Dialog.DownloadLanguages;
                string lang = CultureInfo.CurrentUICulture.Name;
                if (dlg.Items.Contains(lang))
                {
                    dlg.Selected = lang;
                }
                else
                {
                    dlg.SelectedIndex = 0;
                }
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string fileName = $"{dlg.Selected}.ini";
                    string filePath = $@"{AppConfig.LangsDir}\{fileName}";
                    string dirUrl   = AppConfig.RequestUseGithub ? GithubLangsRawDir : GiteeLangsRawDir;
                    bool   flag     = WebStringToFile(filePath, dirUrl);
                    if (!flag)
                    {
                        MessageBoxEx.Show(fileName + ": " + AppString.Message.WebDataReadFailed);
                    }
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 32
0
        private void CreateMissingGlobalMenuItem_Click(object sender, EventArgs e)
        {
            if (this.SystemImplementation == null)
                return;

            List<Definitions.Description.Global> globals = new List<Definitions.Description.Global>();
            foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols)
                globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalVariable) || (g.Definition is Definitions.Description.GlobalConstant)));

            SelectDialog<Definitions.Description.Global> dlg = new SelectDialog<Definitions.Description.Global>();
            dlg.CheckBoxes = true;
            dlg.Items = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name);
            dlg.Columns = new SelectDialogColumn<Definitions.Description.Global>[] {
                new SelectDialogColumn<Definitions.Description.Global>("Global", 200, (g => g.Name)),
                new SelectDialogColumn<Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name)) };

            if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK)
                return;

            foreach (var g in dlg.SelectedItems)
            {
                Global global = new Global(this.SystemImplementation);
                global.Name = g.Name;
                global.GlobalType = (g.Definition is Definitions.Description.GlobalConstant) ? GlobalTypeEnum.Constant : GlobalTypeEnum.Variable;
                global.Description = g.Description;
                global.ImplementedProtocols.Add(g.Protocol.Name);
                global.Initializer.Source = g.Initializer;
                global.DefiningProtocol = g.Protocol.Name;
                global.Description = g.Description;

                if (!this.SystemImplementation.GlobalItems.Contains(global))
                    this.SystemImplementation.GlobalItems.Add(global);
            }
            this.SystemImplementation.GlobalItems.TriggerChanged();
        }
Ejemplo n.º 33
0
 private void btnState_Click(object sender, EventArgs e)
 {
     DataTable dt = bll.FillDataTable("CMD.SelectProductState");
     SelectDialog selectDialog = new SelectDialog(dt, StateFields, false);
     if (selectDialog.ShowDialog() == DialogResult.OK)
     {
         this.txtStateNo.Text = selectDialog["StateNo"];
     }
 }
Ejemplo n.º 34
0
		static bool ShowProgramOptions (ProgramInformation program)
		{
			var dialog = new SelectDialog<string> (new string[] {
				"Run Program",
				"Run In AOT",
				"AOT Compile",
				"Delete Program",
			}, "Options", true);
			dialog.Show ();
			if (!dialog.EscPressed) {
				Action programAction = null;
				switch (dialog.GetSelectionIndex ()) {
				case 0:
					Lcd.Instance.Clear ();
					Lcd.Instance.DrawBitmap (monoLogo, new Point ((int)(Lcd.Width - monoLogo.Width) / 2, 5));					
					Rectangle textRect = new Rectangle (new Point (0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point (Lcd.Width, Lcd.Height - 2));
					Lcd.Instance.WriteTextBox (Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
					Lcd.Instance.Update ();						
					programAction = () => ProgramManager.Instance.StartProgram(program,false);	
					break;
				case 1:
					if (!program.IsAOTCompiled) 
					{
						if (AOTCompileAndShowDialog (program)) 
						{
							programAction = () => ProgramManager.Instance.StartProgram(program,true);	
						}
					} 
					else 
					{
						programAction = () => ProgramManager.Instance.StartProgram(program, true);
					}
					break;
				case 3:
						
					if (program.IsAOTCompiled) {
						var questionDialog = new QuestionDialog ("Progran already compiled. Recompile?", "AOT recompile");
						if (questionDialog.Show ()) {
							AOTCompileAndShowDialog (program);
						}
					} 
					else 
					{
						AOTCompileAndShowDialog (program);
					}
					break;
				case 4:
					var question = new QuestionDialog ("Are you sure?", "Delete");
					if (question.Show ()) 
					{
						var step = new StepContainer (() => {ProgramManager.Instance.DeleteProgram(program); return true;}, "Deleting ", "Error deleting program"); 
						var progressDialog = new ProgressDialog ("Program", step);
						progressDialog.Show ();
						updateProgramList = true;
					}
					break;
				}
				if (programAction != null) 
				{
					Console.WriteLine("Starting application");
					programAction();					
					Console.WriteLine ("Done running application");
				}
				return updateProgramList;
			}
			return false;
			
		}
Ejemplo n.º 35
0
        static bool ShowProgramOptions(string programFolder)
        {
            string fileName = "";
            try {
                fileName = Directory.EnumerateFiles (programFolder, "*.exe").First ();
            } catch {
                var info = new InfoDialog (programFolder + "is not executable", true, "Program");
                info.Show ();
                Directory.Delete (programFolder, true);
                updateProgramList = true;
                return true;
            }

            var dialog = new SelectDialog<string> (new string[] {
                "Run Program",
                "Debug Program",
                "Run In AOT",
                "AOT Compile",
                "Delete Program",
            }, "Options", true);
            dialog.Show ();
            if (!dialog.EscPressed) {
                Action programAction = null;
                switch (dialog.GetSelectionIndex ()) {
                case 0:
                    Lcd.Instance.Clear ();
                    Lcd.Instance.DrawBitmap (monoLogo, new Point ((int)(Lcd.Width - monoLogo.Width) / 2, 5));
                    Rectangle textRect = new Rectangle (new Point (0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point (Lcd.Width, Lcd.Height - 2));
                    Lcd.Instance.WriteTextBox (Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
                    Lcd.Instance.Update ();
                    programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.Normal);
                    break;
                case 1:
                    programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.Debug);
                    break;
                case 2:
                    if (!AOTHelper.IsFileCompiled (fileName)) {
                        if (AOTCompileAndShowDialog (programFolder)) {
                            programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.AOT);
                        }
                    } else {
                        programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.AOT);
                    }
                    break;
                case 3:

                    if (AOTHelper.IsFileCompiled (fileName)) {
                        var questionDialog = new QuestionDialog ("Progran already compiled. Recompile?", "AOT recompile");
                        if (questionDialog.Show ()) {
                            AOTCompileAndShowDialog (programFolder);
                        }
                    } else {
                        AOTCompileAndShowDialog (programFolder);
                    }
                    break;
                case 4:
                    var question = new QuestionDialog ("Are you sure?", "Delete");
                    if (question.Show ()) {
                        var step = new StepContainer (() => {
                            Directory.Delete (programFolder, true);
                            return true;
                        }, "Deleting ", "Error deleting program");
                        var progressDialog = new ProgressDialog ("Program", step);
                        progressDialog.Show ();
                        updateProgramList = true;
                    }
                    break;
                }
                if (programAction != null)
                {
                    Console.WriteLine("Starting application");
                    programAction();
                    Console.WriteLine ("Done running application");
                }
                return updateProgramList;
            }
            return false;
        }
Ejemplo n.º 36
0
        private void CreateMissingClassMenuItem_Click(object sender, EventArgs e)
        {
            if (this.SystemImplementation == null)
                return;

            List<Definitions.Description.Global> globals = new List<Definitions.Description.Global>();
            foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols)
                globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalClass)));

            SelectDialog<Definitions.Description.Global> dlg = new SelectDialog<Definitions.Description.Global>();
            dlg.CheckBoxes = true;
            dlg.Items = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name);
            dlg.Columns = new SelectDialogColumn<Definitions.Description.Global>[] {
                new SelectDialogColumn<Definitions.Description.Global>("Global", 200, (g => g.Name)),
                new SelectDialogColumn<Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name)) };

            if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK)
                return;

            foreach(var g in dlg.SelectedItems)
            {
                Class cls = new Class(this.SystemImplementation);
                cls.Name = g.Name;
                cls.SuperclassName = "Object";
                cls.Description = g.Description;
                cls.ImplementedClassProtocols.Add(g.Protocol.Name);
                cls.Initializer.Source = g.Initializer;
                cls.InstanceState = InstanceStateEnum.NamedObjectVariables;
                cls.DefiningProtocol = g.Protocol.Name;

                if (!this.SystemImplementation.GlobalItems.Contains(cls))
                    this.SystemImplementation.GlobalItems.Add(cls);
            }
            this.SystemImplementation.GlobalItems.TriggerChanged();
        }
Ejemplo n.º 37
0
		private void OnSelectDialogExit(SelectDialog<string> dialog)
		{
			if (!dialog.EscPressed) {
				switch (dialog.GetSelectionIndex ()) {
				case 0:
					var startDialog = new ExecuteProgramDialog (this.programInformation, false, useEscToStop);
					startDialog.Start (Parent);
					break;
				case 1:
					if (!programInformation.IsAOTCompiled)
					{
						compileBeforeExecution.SetFocus (Parent, OnCompileInfoDialogExit); 
					} 
					else 
					{
						var start = new ExecuteProgramDialog (this.programInformation, true, useEscToStop);
						start.Start (Parent);
					}
					break;
				case 2:
					if (programInformation.IsAOTCompiled)
					{
						aotQuestionDialog.SetFocus (Parent,OnCompileDialogExit);
					} 
					else 
					{
						compileDialog.SetFocus (Parent);
					}
					break;
				case 3:
					deleteQuestionDialog.SetFocus (Parent,OnDeleteDialogExit);
					break;
				}
			}		
		}
Ejemplo n.º 38
0
        private void btnTaskID_Click(object sender, EventArgs e)
        {
            DataTable dt = bll.FillDataTable("WCS.SelectTask", new DataParameter[] { new DataParameter("{0}", string.Format("WCS_TASK.TaskType='11' and WCS_TASK.CellCode='{0}'",CellCode)) });

            SelectDialog selectDialog = new SelectDialog(dt, TaskFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtTaskNo.Text = selectDialog["TaskNo"];
            }
        }
Ejemplo n.º 39
0
        private void btnProductCode_Click(object sender, EventArgs e)
        {
            if (this.txtBillNo.Text.Trim().Length <= 0)
            {
                MessageBox.Show("请先选择入库单据号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtBillNo.Focus();
                return;
            }

            DataTable dt = bll.FillDataTable("CMD.SelectProduct", new DataParameter[] { new DataParameter("{0}", string.Format("AreaCode='{0}'",AreaCode))});

            SelectDialog selectDialog = new SelectDialog(dt, ProductFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtProductCode.Text = selectDialog["ProductCode"];
            }
        }
Ejemplo n.º 40
0
    protected void OnProgressDialogResponse(object o, EventArgs args)
    {
        if (list != null && list.Count > 0) {
            SelectDialog listDialog = new SelectDialog (list, searchCategory);
            int selection = listDialog.Run();

            if (selection != -1) {
                results = (SearchResults)list[selection];
                FillDialogFromSearch (results);
            }
        }
        else {
            string message = (Mono.Posix.Catalog.GetString ("No matches for your query"));

            MessageDialog dialog = new MessageDialog (null,
                    DialogFlags.Modal | DialogFlags.DestroyWithParent,
                    MessageType.Warning,
                    ButtonsType.Close,
                    message);
            dialog.Run ();
            dialog.Destroy ();
        }
    }