public ViewBase(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) { _Uri = uri; AppModel = appModel; FrameController = frameController; FrameConfig = frameConfig; }
public ImportSchemeViewModel(IShell shell, IDialogCoordinator dialogCoordinator, IAppModel appModel, IAppConfig appConfig) { _shell = shell; _dialogCoordinator = dialogCoordinator; _appModel = appModel; _appConfig = appConfig; ImportCommand = ReactiveCommand.CreateFromTask(Import); ReloadCommand = ReactiveCommand.CreateFromTask(async() => { if (!_loaded) { await ReloadScheme(); _loaded = true; } }); FolderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); FileName = $"_tmp_{DateTime.UtcNow.Ticks}.kam"; SelectFolderCommand = ReactiveCommand.Create(() => { using (var dialog = new FolderBrowserDialog { ShowNewFolderButton = false, SelectedPath = FolderName }) { if (dialog.ShowDialog() == DialogResult.OK) { FolderName = dialog.SelectedPath; } } }); Scheme = new BoxImportSchemeViewModel(); }
/// <summary> /// Стандартный конструктор /// </summary> /// <param name="parResourceManager">Менеджер ресурсов</param> /// <param name="parModel">Модель</param> public AppSoundManager(ResourceManager parResourceManager, IAppModel parModel) { AppSoundManagerMediator = new AppSoundManagerMediator(parResourceManager); AppSoundManagerMediator.MainAppSoundManagerColleague = AppSoundManagerColleague = new AppSoundManagerColleague(AppSoundManagerMediator); ActualAppModel = parModel; }
/// <summary> /// Замена конструктора, процедура инициализации игрового объекта /// </summary> /// <param name="parModel">Модель</param> public GameObject Init(IAppModel parModel) { LinkedAppModel = parModel; //Test = 3; Components = new List <Component>(); return(this); }
public MapViewModel(IAppModel model) { this.model = model; this.model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
/// <summary> /// Стандартный конструктор /// </summary> /// <param name="parTypesLinker">Объект для связывания компонентов модели и отображения</param> /// <param name="parAppModel">Модель приложения</param> /// <param name="parLinkedView">Отображение приложения</param> public ViewEventsOpenTkHandler(ViewBehaviourOpenTkHandlersLinker parTypesLinker, IAppModel parAppModel, AppViewOpenTk parLinkedView) { TypesLinker = parTypesLinker; ViewSideProviderColleague = new ViewProviderOpenTkViewSideColleague(parAppModel.GetViewProviderMediator(), this); AppModelRef = parAppModel; LinkedView = parLinkedView; OpenGlWindowDisplay.Instance.RenderDisplayChanged += OnDisplayChanged; }
public NetDaemonRuntime( IHomeAssistantRunner homeAssistantRunner, IOptions <HomeAssistantSettings> settings, IOptions <AppConfigurationLocationSetting> locationSettings, IAppModel appModel, IServiceProvider serviceProvider, ILogger <NetDaemonRuntime> logger, ICacheManager cacheManager) { _haSettings = settings.Value; _homeAssistantRunner = homeAssistantRunner; _locationSettings = locationSettings; _appModel = appModel; _serviceProvider = serviceProvider; _logger = logger; _cacheManager = cacheManager; }
public WizardViewModel(IAppModel appModel, IShell shell) { appModel_ = appModel; shell_ = shell; Title = "Creating a board"; this.WhenAnyValue(x => x.BoardName) .Where(x => !string.IsNullOrWhiteSpace(x)) .Subscribe(v => FileName = BoardNameToFileName(v)); /* TODO: Delayed check folder exists (Error) * this.WhenAnyValue(x => x.FolderName) * .Throttle() * .Subscribe();*/ // TODO: Delayed check file exists (Warning) BoardName = "My Board"; FolderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); SelectFolderCommand = ReactiveCommand.Create(SelectFolder); ColumnList = new ReactiveList <string>() { "Backlog", "In progress", "Done" }; AddColumnCommand = ReactiveCommand.Create(() => ColumnList.Add("New column")); RowList = new ReactiveList <string>() { "Important", "So-so", "Trash" }; AddRowCommand = ReactiveCommand.Create(() => RowList.Add("New row")); CreateCommand = ReactiveCommand.Create(Create); }
/// <summary> /// コンストラクター /// </summary> /// <param name="appModel">アプリケーションModelのインスタンス</param> /// <param name="dialogHelper">ダイアログHelperのインスタンス</param> public MainWindowViewModel(IAppModel appModel, IDialogHelper dialogHelper) { AppModel = appModel; DialogHelper = dialogHelper; AppModel.LoadSettings(); FromFolder = ReactiveProperty .FromObject(AppModel, x => x.FromFolder) .AddTo(Disposables); ToFolder = ReactiveProperty .FromObject(AppModel, x => x.ToFolder) .AddTo(Disposables); CreateFolderIfNotExist = ReactiveProperty .FromObject(AppModel, x => x.CreateFolderIfNotExist) .AddTo(Disposables); OverwriteIfExist = ReactiveProperty .FromObject(AppModel, x => x.OverwriteIfExist) .AddTo(Disposables); ClassifyAsDatas = ReactiveProperty .FromObject(AppModel, x => x.ClassifyAsDatas) .AddTo(Disposables); ButtonEnable = new ReactiveProperty <bool>(true); SelectFromFolderCommand = ButtonEnable .ToReactiveCommand() .WithSubscribe(_ => SelectFromFolderAction()) .AddTo(Disposables); SelectToFolderCommand = ButtonEnable .ToReactiveCommand() .WithSubscribe(_ => SelectToFolderAction()) .AddTo(Disposables); SaveSettingsCommand = ButtonEnable .ToAsyncReactiveCommand() .WithSubscribe(_ => SaveSettingsActionAsync()) .AddTo(Disposables); ExecuteCommand = ButtonEnable .ToAsyncReactiveCommand() .WithSubscribe(_ => ExecuteActionAsync()) .AddTo(Disposables); }
public StartupViewModel(IShell shell, IAppModel appModel) { shell_ = shell; appModel_ = appModel; appModel_.LoadConfig(); var recent = appModel_.GetRecentDocuments(); BaseList = new ReactiveList <string>(recent); OpenRecentDbCommand = ReactiveCommand.Create <string>(uri => { if (!OpenBoardView(uri)) { appModel_.RemoveRecent(uri); appModel_.SaveConfig(); BaseList.Remove(uri); DialogCoordinator.Instance.ShowMessageAsync(this, "Ошибка", "База была удалена или перемещена из данной папки"); } }); NewDbCommand = ReactiveCommand.Create(() => shell.ShowView <WizardView>()); OpenDbCommand = ReactiveCommand.Create(() => { var dialog = new OpenFileDialog() { Filter = "SQLite DataBase | *.db", Title = "Открытие базы" }; if (dialog.ShowDialog() == DialogResult.OK) { OpenBoardView(dialog.FileName); } }); }//ctor
public ViewNormal(IAppModel appModel, IFrameController frameController, IFrameConfig config) : base("ViewNormal.qml", appModel, frameController, config) { }
public TestView(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig config) : base(uri, appModel, frameController, config) { ViewModelMock = Mock.Of <IViewModel>(); }
public NotificationManager(IAppModel model) { _model = model; _notificationFactory = new NotificationFactory(); }
public ExportViewModel(IShell sh, IAppModel am, IDialogCoordinator dc, IAppConfig cfg, IMapper mapper) { shell = sh; appModel = am; dialCoord = dc; this.mapper = mapper; _appConfig = cfg; AvailableBoxes = appModel.Boxes; boards = new SourceList <BoardToExport>(); AvailableBoards = boards.SpawnCollection(); ExportJson = true; DatePostfix = true; SplitBoardsToFiles = false; PdfOptionsAvailable = new PdfOptionsAvailable { PageSizes = Enum.GetValues(typeof(PageSize)).Cast <PageSize>().ToArray(), PageOrientations = Enum.GetValues(typeof(PageOrientation)).Cast <PageOrientation>().ToArray(), ScaleFittings = Enum.GetValues(typeof(ScaleFitting)).Cast <ScaleFitting>().ToArray() }; PdfOptions = new PdfOptions { PageSize = PageSize.A4, PageOrientation = PageOrientation.Portrait, ScaleOptions = new ScaleOptions { Padding = new Thickness(), ScaleToFit = true, ScaleFitting = ScaleFitting.BothDirections, MaxScale = 1.0, MinScale = 0.0 } }; var canExport = boards .Connect() .AutoRefresh() .Filter(x => x.IsChecked) .Select(x => AvailableBoards.Count(y => y.IsChecked) > 0 && !string.IsNullOrEmpty(SelectedBox.Uri) && File.Exists(SelectedBox.Uri)); ExportCommand = ReactiveCommand.CreateFromTask(ExportCommandExecute, canExport); SelectTargetFolderCommand = ReactiveCommand.Create(SelectTargetFolderCommandExecute); CancelCommand = ReactiveCommand.Create(Close); this.ObservableForProperty(x => x.SelectedBox) .Where(x => x.Value != null) .Select(x => x.Value) .Subscribe(box => { boards.ClearAndAddRange(box.Boards.Items .Select(x => new BoardToExport { Board = x, IsChecked = true })); TargetFile = Path.GetFileNameWithoutExtension(box.Uri) + "_export"; }); this.ObservableForProperty(x => x.TargetFolder) .Subscribe(x => cfg.ArchiveFolder = x.Value); SelectedBox = AvailableBoxes.First(); var fi = new FileInfo(SelectedBox.Uri); TargetFolder = cfg.ArchiveFolder ?? fi.DirectoryName; _appConfig.ColorThemeObservable .Subscribe(x => ColorTheme = x); }
public AboutViewModel(IAppModel model) { _model = model; }
public ViewManagerTest() { _AppModelMock = Mock.Of <IAppModel>(); _FrameControllerMock = Mock.Of <IFrameController>(); _FrameConfigMock = Mock.Of <IFrameConfig>(); }
public ViewBorder(IAppModel appModel, IFrameController frameController, IFrameConfig config) : base("ViewBorder.qml", appModel, frameController, config) { }
public WizardViewModel(IAppModel appModel, IShell shell) { this.appModel = appModel; this.shell = shell as IDistinctShell; validator = new WizardValidator(); Title = "Creating new file"; FullTitle = "Creating new file"; BoardsInFile = new ReactiveList <string>(); this.WhenAnyValue(x => x.BoardName) .Where(x => !string.IsNullOrWhiteSpace(x)) .Subscribe(v => { if (!InExistedFile) { FileName = BoardNameToFileName(v); } }); BoardName = "My Board"; FolderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); SelectFolderCommand = ReactiveCommand.Create(SelectFolder); ColumnList = new ReactiveList <LocalDimension> { new LocalDimension("Backlog"), new LocalDimension("In progress"), new LocalDimension("Done") }; AddColumnCommand = ReactiveCommand.Create(() => ColumnList.Add(new LocalDimension("New column"))); DeleteColumnCommand = ReactiveCommand .Create <LocalDimension>(column => { ColumnList.Remove(column); UpdateDimensionList(ColumnList); }); RowList = new ReactiveList <LocalDimension>() { new LocalDimension("Important"), new LocalDimension("So-so"), new LocalDimension("Trash") }; AddRowCommand = ReactiveCommand.Create(() => RowList.Add(new LocalDimension("New row"))); DeleteRowCommand = ReactiveCommand .Create <LocalDimension>(row => { RowList.Remove(row); UpdateDimensionList(RowList); }); CreateCommand = ReactiveCommand.CreateFromTask(Create); CancelCommand = ReactiveCommand.Create(Close); this.WhenAnyObservable(s => s.ColumnList.ItemChanged) .Subscribe(_ => UpdateDimensionList(ColumnList)); this.WhenAnyObservable(s => s.RowList.ItemChanged) .Subscribe(_ => UpdateDimensionList(RowList)); this.WhenAnyObservable(s => s.ColumnList.ItemsAdded) .Subscribe(_ => UpdateDimensionList(ColumnList)); this.WhenAnyObservable(s => s.RowList.ItemsAdded) .Subscribe(_ => UpdateDimensionList(RowList)); this.WhenAnyObservable(s => s.AllErrors.Changed) .Subscribe(_ => CanCreate = !AllErrors.Any() && ColumnList.Count(col => col.HasErrors) == 0 && RowList.Count(row => row.HasErrors) == 0); }
public MainViewModel(IAppModel model) { _model = model; }
public NotificationManager(IAppModel model) { _model = model; }
public ViewColorize(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) : base("ViewColorized.qml", appModel, frameController, frameConfig) { }
public ViewManager(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) { _appModel = appModel; _frameController = frameController; _frameConfig = frameConfig; }
public SongsController(IAppModel model) { _model = model; }
public ViewTestBase() { _AppModelMock = Mock.Of <IAppModel>(); _FrameControllerMock = Mock.Of <IFrameController>(); _FrameConfigMock = Mock.Of <IFrameConfig>(); }
public StartupViewModel(IShell shell, IAppModel appModel, IDialogCoordinator dc, IMapper mp, IAppConfig cfg, ILogger l) { this.shell = shell as IShell; this.appModel = appModel; dialCoord = dc; mapper = mp; appConfig = cfg; log = l; ColorTheme = appConfig.ColorTheme; initialized = false; OpenRecentBoxCommand = ReactiveCommand.Create <RecentViewModel>(async(rvm) => { if (await OpenBoardView(rvm.Uri)) { appConfig.UpdateRecent(rvm.Uri, rvm.Pinned); } }); NewFileCommand = ReactiveCommand.Create(() => this.shell.ShowView <WizardView>( new WizardViewRequest { ViewId = "Creating new file", Uri = null })); OpenFileCommand = ReactiveCommand.CreateFromTask(async _ => { var dialog = new OpenFileDialog { Filter = @"SQLite DataBase | *.kam", Title = @"Select exists database" }; if (dialog.ShowDialog() == DialogResult.OK) { var uri = dialog.FileName; if (await OpenBoardView(uri)) { appConfig.UpdateRecent(uri, false); } } }); OpenPublicBoardCommand = ReactiveCommand .CreateFromTask <PublicBoardJson>(OpenPublicBoardCommandExecute); ImportCommand = ReactiveCommand.Create(() => this.shell.ShowView <ImportView>(null, new UiShowOptions { Title = "Import" })); var whenBoardSelected = shell .WhenAny(x => x.SelectedView, x => x.Value?.ViewModel is BoardEditViewModel) .Publish(); ExportCommand = ReactiveCommand.Create(() => this.shell.ShowView <ExportView>(null, new UiShowOptions { Title = "Export" }), whenBoardSelected); PrintCommand = ReactiveCommand.Create(PrintCommandExecute, whenBoardSelected); whenBoardSelected.Connect(); ShowStartupCommand = ReactiveCommand.Create(() => { shell.ShowView <StartupView>( viewRequest: new ViewRequest { ViewId = StartupViewModel.StartupViewId }, options: new UiShowOptions { Title = "Start Page", CanClose = false }); }); SettingsCommand = ReactiveCommand.Create(() => { shell.ShowView <SettingsView>( viewRequest: new ViewRequest { ViewId = SettingsViewModel.StartupViewId }, options: new UiShowOptions { Title = "Settings", CanClose = true }); }); ExitCommand = ReactiveCommand.Create(() => App.Current.Shutdown()); Pinned = appConfig.RecentObservable .Filter(x => x.Pinned); var notPinned = appConfig.RecentObservable .Filter(x => !x.Pinned); Today = notPinned .Filter(x => x.LastAccess.IsToday()); Yesterday = notPinned .Filter(x => x.LastAccess.IsYesterday()); ThisMonth = notPinned .Filter(x => !x.LastAccess.IsToday() && !x.LastAccess.IsYesterday() && x.LastAccess.IsThisMonth()); Older = notPinned .Filter(x => !x.LastAccess.IsToday() && !x.LastAccess.IsYesterday() && !x.LastAccess.IsThisMonth()); // TODO: move autosaver to AppConfig appConfig.RecentObservable .WhenAnyPropertyChanged("Pinned") .Subscribe(x => appConfig.UpdateRecent(x.Uri, x.Pinned)); appConfig.GetStarted.Subscribe(x => GetStarted = x); var ver = Assembly.GetExecutingAssembly().GetName(); appConfig.Basement .Subscribe(x => Basement = x + $"v{ver.Version.Major}.{ver.Version.Minor}.{ver.Version.Build}"); if (appConfig.OpenLatestAtStartup) { foreach (var uri in appConfig.LastOpenedAtStartup) { Dispatcher.CurrentDispatcher.InvokeAsync(() => OpenBoardView(uri)); } } appConfig.ColorThemeObservable .Subscribe(x => ColorTheme = x); } //ctor
public StartupViewModel(IShell shell, IAppModel appModel) { this.shell = shell as IDistinctShell; this.appModel = appModel; this.appModel.LoadConfig(); var recent = this.appModel.GetRecentDocuments(); BaseList = new ReactiveList <string>(recent.Take(3)); AccentChangeCommand = ReactiveCommand.Create <string>(color => ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(color), ThemeManager.GetAppTheme("baselight"))); OpenRecentDbCommand = ReactiveCommand.Create <string>(uri => { if (OpenBoardView(uri)) { return; } RemoveRecent(uri); DialogCoordinator.Instance.ShowMessageAsync(this, "Ошибка", "Файл был удалён или перемещён из данной папки"); }); RemoveRecentCommand = ReactiveCommand.Create <string>(RemoveRecent); NewFileCommand = ReactiveCommand.Create(() => this.shell.ShowDistinctView <WizardView>("Creating new file", new WizardViewRequest { InExistedFile = false })); NewBoardCommand = ReactiveCommand.Create(() => { var dialog = new OpenFileDialog { Filter = @"SQLite DataBase | *.db", Title = @"Выбор существующего файла базы данных" }; if (dialog.ShowDialog() == DialogResult.OK) { var uri = dialog.FileName; AddRecent(uri); this.shell.ShowDistinctView <WizardView>($"Creating new board in {uri}", new WizardViewRequest { InExistedFile = true, Uri = uri }); } }); OpenFileCommand = ReactiveCommand.Create(() => { var dialog = new OpenFileDialog { Filter = @"SQLite DataBase | *.db", Title = @"Выбор существующего файла базы данных" }; if (dialog.ShowDialog() == DialogResult.OK) { var uri = dialog.FileName; OpenBoardView(uri); AddRecent(uri); } }); } //ctor
public AppController(IAppModel model, IFormManager manager) { this.model = model; this.manager = manager; }
public WizardViewModel(IAppModel appModel, IShell shell, IDialogCoordinator dc, IAppConfig cfg, ITemplates templates) { this.appModel = appModel; this.shell = shell; dialCoord = dc; appConfig = cfg; ColorTheme = appConfig.ColorTheme; Templates = templates.GetBoardTemplates().Result; Columns = new ObservableCollection <Column>(); Rows = new ObservableCollection <Row>(); FillFromTemplateCommand = ReactiveCommand.Create(() => { if (SelectedTemplate == null) { return; } Columns.Clear(); Columns.AddRange(SelectedTemplate.Columns); Rows.Clear(); Rows.AddRange(SelectedTemplate.Rows); }); ClearAllCommand = ReactiveCommand.Create(() => { Columns.Clear(); Rows.Clear(); }); CreateCommand = ReactiveCommand.CreateFromTask(CreateCommandExecute); CancelCommand = ReactiveCommand.Create(this.Close); SelectFolderCommand = ReactiveCommand.Create(() => { var dialog = new FolderBrowserDialog { ShowNewFolderButton = false, SelectedPath = FolderName }; if (dialog.ShowDialog() == DialogResult.OK) { FolderName = dialog.SelectedPath; } }); AddColumnCommand = ReactiveCommand.CreateFromTask(async _ => { var ts = await dialCoord.ShowInputAsync(this, "Info", $"Enter new column name"); if (string.IsNullOrEmpty(ts)) { return; } if (Columns.Any(x => x.Name == ts)) { return; } Columns.Add(new Column { Name = ts }); }); AddRowCommand = ReactiveCommand.CreateFromTask(async _ => { var ts = await dialCoord.ShowInputAsync(this, "Info", $"Enter new row name"); if (string.IsNullOrEmpty(ts)) { return; } if (Rows.Any(x => x.Name == ts)) { return; } Rows.Add(new Row { Name = ts }); }); Title = "Creating new board"; FullTitle = Title; this.WhenAnyValue(x => x.BoardName) .Where(x => !string.IsNullOrWhiteSpace(x) && IsNewFile) .Subscribe(v => FileName = BoardNameToFileName(v)); appConfig.ColorThemeObservable .Subscribe(x => UpdateColorTheme()); }
// connect the scripting language to the IDrawing instance public static void SetAppModel(IAppModel appmodel) { AppModel = appmodel; }