/// <summary> /// 初始化ComboBox /// </summary> private void initComboBox() { var comboBoxDeviceList = RepositoryPresenter.getDefaultDevices(); ComboBoxQueryUser.labelText = "所有用户"; ComboBoxQueryDevice.labelText = "所有类别"; ComboBoxQueryUserLog.labelText = "当前用户"; ComboBoxQueryCategoryLog.labelText = "所有类别"; comboBoxDeviceList.ForEach(str => { ComboBoxQueryDevice.addItem(str); ComboBoxQueryCategoryLog.addItem(str); }); ComboBoxQueryUserLog.addItem("当前用户"); ComboBoxQueryUser.addItem("全部"); var userNameList = RepositoryPresenter.queryUserNameAll(); userNameList.ForEach(str => { ComboBoxQueryUserLog.addItem(str); ComboBoxQueryUser.addItem(str); }); }
public DockPanelService(IAppContext context, RepositoryPlugin plugin, RepositoryPresenter presenter) { if (context == null) { throw new ArgumentNullException("context"); } if (plugin == null) { throw new ArgumentNullException("plugin"); } if (presenter == null) { throw new ArgumentNullException("presenter"); } var panels = context.DockPanels; panels.Lock(); try { var panel = panels.Add(presenter.GetInternalObject(), DockPanelKeys.Repository, plugin.Identity); panel.Caption = "Repository"; panel.SetIcon(Resources.ico_folder24); panel.DockTo(panels.Toolbox, DockPanelState.Tabbed, 300); panel.TabPosition = 0; } finally { panels.Unlock(); } }
public LegendListener(IAppContext context, RepositoryPlugin plugin, RepositoryPresenter presenter) { if (plugin == null) { throw new ArgumentNullException("plugin"); } if (presenter == null) { throw new ArgumentNullException("presenter"); } _context = context; _plugin = plugin; _presenter = presenter; plugin.LayerAdded += OnLayerAdded; plugin.LayerRemoved += (s, e) => UpdateRepositoryTree(); plugin.ProjectClosed += (s, e) => UpdateRepositoryTree(); plugin.MapLocked += (s, e) => UpdateRepositoryTree(); }
/// <summary> /// 实验室设备的库存情况查询 /// </summary> private void BtnQuery_Click(object sender, RoutedEventArgs e) { var facilityCategory = ComboBoxQueryDevice.text.Trim(); var facilityUser = ComboBoxQueryUser.text.Trim(); var facility = new Facility(DeviceStatus.EXIST); facility.category = facilityCategory; switch (_queryStatus) { case QueryStatus.LABORARY: facility.ownUser = "******"; break; case QueryStatus.ONESELF: facility.ownUser = _user.name; break; case QueryStatus.WHOLE: facility.ownUser = facilityUser; break; default: throw new Exception("查询状态设置错误"); } try { DataGridViewQuery.ItemsSource = RepositoryPresenter.queryStorageLimitUser(facility).DefaultView; //被查询器件计数及计价 var psum = 0; // 定义总数为0 显示 总库存量和总价值 double msum = 0; //定义总价为0 LabelDevicesSum.Content = psum.ToString(); LabelPriceSum.Content = msum.ToString(CultureInfo.CurrentCulture); foreach (var itemRaw in DataGridViewQuery.Items) { var item = itemRaw as DataRowView; if (item == null) { continue; } psum = psum + Convert.ToInt32(item.Row[5].ToString()); msum = msum + Convert.ToDouble(item.Row[9].ToString()); } LabelDevicesSum.Content = psum.ToString(); LabelPriceSum.Content = msum.ToString(CultureInfo.CurrentCulture); } catch (NotFoundFacilityException) { DataGridViewQuery.ItemsSource = null; MessageBox.Show("未找到任何设备!", "提示"); } if (DataGridViewQuery.Items.Count == 0) { setButtonEnabled(false, false, true, false); } else if (_queryStatus == QueryStatus.LABORARY) { setButtonEnabled(true, false, true, false); } else if (_queryStatus == QueryStatus.ONESELF) { setButtonEnabled(false, true, true, true); } }
public override void Initialize(IAppContext context) { _repositoryPresenter = context.Container.GetSingleton <RepositoryPresenter>(); _dockPanelService = context.Container.GetInstance <DockPanelService>(); _legendListener = context.Container.GetSingleton <LegendListener>(); }
/// <summary> /// System.Windows.Application.Startup イベントを発生させます。 /// </summary> /// <param name="e">イベント データを格納している System.Windows.StartupEventArgsです。</param> protected override async void OnStartup(StartupEventArgs e) { string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); ProfileOptimization.SetProfileRoot(path); ProfileOptimization.StartProfile("Naya.profile"); if (!Environment.Is64BitOperatingSystem || !Environment.Is64BitProcess) { MessageBox.Show("Not Support 32BitOS."); Environment.Exit(-1); } AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException); // Setup PluginPresenter. { PluginPresenter pluginPresenter = new PluginPresenter(); string pluginPath = Path.Combine(path, "Plugins"); pluginPresenter.Setup(pluginPath); this.presenter.AddPluginPresenter(pluginPresenter); } // Setup LogPresenter { OutputLogFactory factory = new OutputLogFactory(); LogPresenter logPresenter = new LogPresenter(factory); this.presenter.AddLogPresenter(logPresenter); } // Setup OperationPresenter { OperationPresenter operationPresenter = new OperationPresenter(); this.presenter.AddOperationPresenter(operationPresenter); } // Setup MenuPresenter { MenuPresenter menuPresenter = new MenuPresenter(); this.presenter.AddMenuPresenter(menuPresenter); } // Setup PanelPresenter { PanelPresenter panelPresenter = new PanelPresenter(); this.presenter.AddPanelPresenter(panelPresenter); } // Setup RepositoryPresenter { RepositoryPresenter repositoryPresenter = new RepositoryPresenter(); this.presenter.AddRepositoryPresenter(repositoryPresenter); } // Setup ScriptPresenter { PythonScriptBridge scriptBridge = new PythonScriptBridge("Naya"); ScriptPresenter scriptPresenter = new ScriptPresenter(scriptBridge); this.presenter.AddScriptPresenter(scriptPresenter); } MainWindow window = new MainWindow(); MainViewModel viewModel = new MainViewModel(); GlobalPresenter.SetOwner(window); window.DataContext = viewModel; window.Show(); window.IsEnabled = false; await NayaPresenter.Initialize(); if (LayoutHelper.HasAvalonDockConfigFile()) { window.LoadLayout(); } else { GlobalPresenter.MakeDefaultTools(); } window.IsEnabled = true; }