public void ChangeFunctionMode(FunctionMode newMode) { if (this.currentFunctionMode == newMode) { return; } this.CurrentFunctionMode = newMode; Control control = GetMainControlFromFunctionMode(newMode); SetMainControl(control); }
void Layers_LayerRemoved(object sender, LayerEventArgs e) { UnattachLayerFromPlugin(e.Layer); //Hack to make it so the Selection Status display would update when a layer was removed. App.Map.Layers.SelectedLayer = null; App.DockManager.HidePanel("kDataExplorer"); FunctionMode f = App.Map.FunctionMode; App.Map.FunctionMode = f; }
//Change menu void ChooseFunction(FunctionMode funcMode) { switch (funcMode) { case FunctionMode.Weather: { View.CloseAllMenus(); View.AddMenu(menu_1a); break; } } }
/// <summary> /// Turns on the line drawing mode /// </summary> public void ActivateLine() { //add mouse handlers to mainMap's mouse handlers mainMap.MouseDown += mouseDown; mainMap.MouseMove += mouseMove; //Save the current function and cursor to be restored when DeactivateLine is called function = mainMap.FunctionMode; cursor = mainMap.Cursor; mainMap.FunctionMode = FunctionMode.None; mainMap.ActivateMapFunction(this); this.YieldStyle = (YieldStyles)0xf; mainMap.Cursor = Cursors.Cross; this.Enabled = true; enabled = true; graph = new GraphForm(mainMap); graph.Owner = mainMap.ParentForm; addLineLayer(); }
private void Map_KeyDown(object sender, KeyEventArgs e) { // Allow panning if the space is pressed. if (e.KeyCode == Keys.Space && !isPanningTemporarily) { previousFunction = this.FunctionMode; this.FunctionMode = FunctionMode.Pan; isPanningTemporarily = true; } foreach (IMapFunction tool in MapFunctions) { if (tool.Enabled) tool.DoKeyDown(e); } }
/// <summary> /// Handles the Key Down situation /// </summary> /// <param name="e"></param> protected override void OnKeyDown(KeyEventArgs e) { // Allow panning if the space is pressed. if (e.KeyCode == Keys.Space && !isPanningTemporarily) { previousFunction = Map.FunctionMode; Map.FunctionMode = FunctionMode.Pan; isPanningTemporarily = true; } // Arrow-Key Panning if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { if (!BusySet) { Map.IsBusy = true; BusySet = true; } var _source = Map.MapFrame.View; switch (e.KeyCode) { case Keys.Up: Map.MapFrame.View = new Rectangle(_source.X, _source.Y - 20, _source.Width, _source.Height); break; case Keys.Down: Map.MapFrame.View = new Rectangle(_source.X, _source.Y + 20, _source.Width, _source.Height); break; case Keys.Left: Map.MapFrame.View = new Rectangle(_source.X - 20, _source.Y, _source.Width, _source.Height); break; case Keys.Right: Map.MapFrame.View = new Rectangle(_source.X + 20, _source.Y, _source.Width, _source.Height); break; } KeyPanCount++; if (KeyPanCount == 16) { Map.MapFrame.ResetExtents(); KeyPanCount = 0; } else { Map.Invalidate(); } } // Zoom Out if (e.KeyCode == (Keys.LButton | Keys.MButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Subtract) { if (Map.IsZoomedToMaxExtent) { } else { Map.IsBusy = true; Rectangle r = Map.MapFrame.View; r.Inflate(r.Width / 2, r.Height / 2); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } } // Zoom In if (e.KeyCode == (Keys.LButton | Keys.RButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Add) { Map.IsBusy = true; Map.IsZoomedToMaxExtent = false; Rectangle r = Map.MapFrame.View; r.Inflate(-r.Width / 4, -r.Height / 4); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } }
/// <summary> /// Handles the Key Down situation. /// </summary> /// <param name="e">The event args.</param> protected override void OnKeyDown(KeyEventArgs e) { // Allow panning if the space is pressed. if (e.KeyCode == Keys.Space && !_isPanningTemporarily) { _previousFunctionMode = Map.FunctionMode; _previousFunctions.Clear(); IMapFunction pan = Map.MapFunctions.FirstOrDefault(x => x is MapFunctionPan); foreach (var f in Map.MapFunctions) { if (!f.Enabled || (f.YieldStyle & YieldStyles.AlwaysOn) == YieldStyles.AlwaysOn) { continue; // ignore "Always On" functions } int test = (int)(f.YieldStyle & pan.YieldStyle); if (test > 0) { _previousFunctions.Add(f); } } Map.FunctionMode = FunctionMode.Pan; _isPanningTemporarily = true; } // Arrow-Key Panning if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { if (!BusySet) { Map.IsBusy = true; BusySet = true; } var source = Map.MapFrame.View; switch (e.KeyCode) { case Keys.Up: Map.MapFrame.View = new Rectangle(source.X, source.Y + 20, source.Width, source.Height); break; case Keys.Down: Map.MapFrame.View = new Rectangle(source.X, source.Y - 20, source.Width, source.Height); break; case Keys.Left: Map.MapFrame.View = new Rectangle(source.X + 20, source.Y, source.Width, source.Height); break; case Keys.Right: Map.MapFrame.View = new Rectangle(source.X - 20, source.Y, source.Width, source.Height); break; } _keyPanCount++; if (_keyPanCount == 16) { Map.MapFrame.ResetExtents(); _keyPanCount = 0; } else { Map.Invalidate(); } } // Zoom Out if (e.KeyCode == (Keys.LButton | Keys.MButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Subtract) { Map.IsBusy = true; Rectangle r = Map.MapFrame.View; r.Inflate(r.Width / 2, r.Height / 2); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } // Zoom In if (e.KeyCode == (Keys.LButton | Keys.RButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Add) { Map.IsBusy = true; Rectangle r = Map.MapFrame.View; r.Inflate(-r.Width / 4, -r.Height / 4); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } }
/// <summary> /// Handles the Key Down situation /// </summary> /// <param name="e"></param> protected override void OnKeyDown(KeyEventArgs e) { // Allow panning if the space is pressed. if (e.KeyCode == Keys.Space && !isPanningTemporarily) { previousFunction = Map.FunctionMode; Map.FunctionMode = FunctionMode.Pan; isPanningTemporarily = true; } // Arrow-Key Panning if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { if (!BusySet) { Map.IsBusy = true; BusySet = true; } var _source = Map.MapFrame.View; switch (e.KeyCode) { case Keys.Up: Map.MapFrame.View = new Rectangle(_source.X, _source.Y - 20, _source.Width, _source.Height); break; case Keys.Down: Map.MapFrame.View = new Rectangle(_source.X, _source.Y + 20, _source.Width, _source.Height); break; case Keys.Left: Map.MapFrame.View = new Rectangle(_source.X - 20, _source.Y, _source.Width, _source.Height); break; case Keys.Right: Map.MapFrame.View = new Rectangle(_source.X + 20, _source.Y, _source.Width, _source.Height); break; } KeyPanCount++; if (KeyPanCount == 16) { Map.MapFrame.ResetExtents(); KeyPanCount = 0; } else Map.Invalidate(); } // Zoom Out if (e.KeyCode == (Keys.LButton | Keys.MButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Subtract) { Extent MaxExtent = Map.GetMaxExtent(); if ((Map.IsZoomedToMaxExtent == true)) { } else { Map.IsBusy = true; Rectangle r = Map.MapFrame.View; r.Inflate(r.Width / 2, r.Height / 2); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } } // Zoom In if (e.KeyCode == (Keys.LButton | Keys.RButton | Keys.Back | Keys.ShiftKey | Keys.Space | Keys.F17) || e.KeyCode == Keys.Add) { Map.IsBusy = true; Map.IsZoomedToMaxExtent = false; Rectangle r = Map.MapFrame.View; r.Inflate(-r.Width / 4, -r.Height / 4); Map.MapFrame.View = r; Map.MapFrame.ResetExtents(); Map.IsBusy = false; } }
private Control GetMainControlFromFunctionMode(FunctionMode newMode) { /// Equipment Managmenet if (this.currentFunctionMode == FunctionMode.EQ_Inventory) { EQ_InventoryForm control = new EQ_InventoryForm(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditRequest) { NEQ_RequestDetailControl control = new NEQ_RequestDetailControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_ManageRequest) { NEQ_RequestListControl control = new NEQ_RequestListControl(); //control.ItemDoubleClicked += new NEQ_RequestListControl.ItemDoubleClickedHandler(RequestListControl_ItemDoubleClicked); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditQuote) { NEQ_QuoteDetailControl control = new NEQ_QuoteDetailControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_ManageQuote) { NEQ_QuoteListControl control = new NEQ_QuoteListControl(); //control.ItemDoubleClicked += new NEQ_QuoteListControl.ItemDoubleClickedHandler(QuoteListControl_ItemDoubleClicked); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditContract) { NEQ_ContractDetailControl control = new NEQ_ContractDetailControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_ManageContract) { NEQ_ContractListControl control = new NEQ_ContractListControl(); //control.ItemDoubleClicked += new NEQ_ContractListControl.ItemDoubleClickedHandler(EQ_ContractListControl_ItemDoubleClicked); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditOrder) { NEQ_OrderDetailControl control = new NEQ_OrderDetailControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_ManageOrder) { NEQ_OrderListControl control = new NEQ_OrderListControl(); //control.ItemDoubleClicked += new NEQ_OrderListControl.ItemDoubleClickedHandler(EQ_OrderListControl_ItemDoubleClicked); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditInput) { NEQ_InputDetailControl control = new NEQ_InputDetailControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_ManageInput) { NEQ_InputListControl control = new NEQ_InputListControl(); //control.ItemDoubleClicked += new NEQ_InputListControl.ItemDoubleClickedHandler(EQ_InputListControl_ItemDoubleClicked); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditOutput) { NEQ_OutputDetailControl control = new NEQ_OutputDetailControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditDirectOutput) { NEQ_DirectOutputControl control = new NEQ_DirectOutputControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_AddEditInUseOutput) { NEQ_InUseOutputControl control = new NEQ_InUseOutputControl(); return(control); } if (this.currentFunctionMode == FunctionMode.EQ_ManageOutput) { NEQ_OutputListControl control = new NEQ_OutputListControl(); //control.ItemDoubleClicked += new NEQ_OutputListControl.ItemDoubleClickedHandler(EQ_OutputListControl_ItemDoubleClicked); return(control); } // For Equipment support if (this.currentFunctionMode == FunctionMode.EQ_EquipmentCheck) { return(new EQ_EquipmentCheck()); } if (this.currentFunctionMode == FunctionMode.EQ_BrowseData) { return(new EQ_BrowseData()); } /// Hệ thống danh mục if (this.currentFunctionMode == FunctionMode.Equipment) { return(new NEquipmentList()); } if (this.currentFunctionMode == FunctionMode.EQ_Category) { return(new EQ_CategoryList()); } if (this.currentFunctionMode == FunctionMode.Unit) { return(new UnitList()); } if (this.currentFunctionMode == FunctionMode.CoType) { return(new CompanyTypeList()); } if (this.currentFunctionMode == FunctionMode.Supplier) { return(new NSupplierList()); } if (this.currentFunctionMode == FunctionMode.Department) { return(new DepartmentList()); } if (this.currentFunctionMode == FunctionMode.Employee) { return(new EmployeeList()); } if (this.currentFunctionMode == FunctionMode.Role) { return(new RoleList()); } if (this.currentFunctionMode == FunctionMode.User) { return(new UserList()); } if (this.currentFunctionMode == FunctionMode.Store) { return(new NStoreList()); } if (this.currentFunctionMode == FunctionMode.StoreLocation) { return(new NStoreLocationList()); } /// For Equipment Reports if (this.currentFunctionMode == FunctionMode.EQ_EquipmentReport) { return(new EQ_EquipmentReport()); } if (this.currentFunctionMode == FunctionMode.EQ_StoreReport) { return(new EQ_StoreReport()); } if (this.currentFunctionMode == FunctionMode.EQ_RequestRpt) { return(new EQ_RequestReport()); } if (this.currentFunctionMode == FunctionMode.EQ_QuotationRpt) { return(new EQ_QuotationReport()); } if (this.currentFunctionMode == FunctionMode.EQ_OrderRpt) { return(new EQ_OrderReport()); } return(null); }
public static IFunctionDefinition CreateFdlFunctionDefinition(IFunctionManager functionManager, FunctionMode functionMode = FunctionMode.Instantaneous) { //Create function const string CarSpeedDoubledInFdl = "return ($vCar:Chassis * 2)"; var functionDefinition = functionManager.CreateFunctionDefinition(FdlFunctionConstants.UniqueId); // The implementation of a function is completely agnostic. We requested a function definition from // the FDL runtime, so the generic function implementation definition in the definition returned can // be safely cast to the more specific FDL implementation definition. var fdlFunctionImplementationDefinition = (IFdlFunctionImplementationDefinition)functionDefinition.ImplementationDefinition; fdlFunctionImplementationDefinition.FunctionCode = CarSpeedDoubledInFdl; // FDL doesn't define the output for a single parameter - it's simply the return value of the // function - so we have to tell the function executor what to do with the output it generates var outputParameter = FunctionOutputParameterDefinition .Create("vCarDoubled", "FunctionParameters", "Double car speed!") .Units("kph") .FormatOverride("%.2f") .MinimumValue("0.0") .MaximumValue("700.0"); functionDefinition.OutputParameterDefinitions.Add(outputParameter); // Functions in ATLAS 9 have a number of different properties that define how, where, when and on // what a function executes. ATLAS 10 will add more of these properties. Each value here is the // default for its property, shown for illustration. functionDefinition.Name = $"DoubleCarSpeed_{Environment.TickCount}"; functionDefinition.FunctionMode = functionMode; functionDefinition.CalculationModeInfoDefinition.Mode = CalculationMode.EachSamplePoint; functionDefinition.InterpolateBetweenSamples = false; functionDefinition.JoinGapsAroundNull = true; functionDefinition.CalculateOverWholeSession = false; functionDefinition.StoreInSession = false; functionDefinition.ShouldHide = false; functionDefinition.ShouldPersist = false; return(functionDefinition); }