public void AnimateControl(NotepadListItem nli, AnimationFlag af) { switch (af) { case AnimationFlag.NotepadItemOPEN: AnimationLib.OpacityControl(nli, 0, 1, GlobalPreferences.ANIMATION_SPEED_SEC); AnimationLib.MoveToTargetX(nli, 0, -ActualWidth, GlobalPreferences.ANIMATION_SPEED_SEC); break; //Cant really do this. Animations are async so i'd have to have a timed delay when //removing the item from the NotepadList, which would be... a bit complex. //If anyone wants to try and add that delay (using tasks maybe, have a go) //(and msg me or something with the code, and ill add it) case AnimationFlag.NotepadItemCLOSE: //AnimationLib.OpacityControl(nli, 1, 0, AnimationSpeedSeconds); //AnimationLib.MoveToTargetX(nli, -ActualWidth, 0, AnimationSpeedSeconds * 15); // //Task.Run(async () => //{ // await Task.Delay(TimeSpan.FromSeconds(AnimationSpeedSeconds)); // await Application.Current.Dispatcher.InvokeAsync(() => { ViewModel.NotepadItems.Remove(nli); }); //}); break; } }
public MainWindow(NotepadListItem fileItem, bool enableSettingsSave) { InitializeComponent(); InitWindow(); ViewModel.AddNotepadItem(fileItem); IsDuplicatedWindow = enableSettingsSave; Title = "SharpPad"; }
public MainWindow(NotepadListItem fileItem, bool enableSettingsSave) { InitializeComponent(); ViewModel = new MainViewModel(); this.DataContext = ViewModel; ViewModel.MainWind = this; ViewModel.AddNotepadItem(fileItem); IsDuplicatedWindow = true; Title = "SharpPad"; }