private void ReplaceLight(object sender, RoutedEventArgs e) { List <String> fileNames = new List <string>(); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(StaticConstant.mw.LastProjectPath + @"\Light", new List <string>() { ".light" })); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(StaticConstant.mw.LastProjectPath + @"\LightScript", new List <string>() { ".lightScript" })); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(StaticConstant.mw.LastProjectPath + @"\Light", new List <string>() { ".mid" })); ShowLightListDialog dialog = new ShowLightListDialog(StaticConstant.mw, tbFileName.Text, fileNames); if (dialog.ShowDialog() == true) { if (tbFileName.Text.Equals(dialog.selectItem)) { return; } tbFileName.Text = dialog.selectItem; lightFilePlayModel.FileName = tbFileName.Text; NeedRefresh(); } }
public WelcomeUserControl(NewMainWindow mw) { InitializeComponent(); this.mw = mw; List <String> strs = FileBusiness.CreateInstance().GetDirectorysName(AppDomain.CurrentDomain.BaseDirectory + @"\Project"); for (int i = 0; i < strs.Count; i++) { Border border = new Border(); border.Margin = new Thickness(30, 0, 0, 0); border.MouseEnter += StackPanel_MouseEnter; border.MouseLeave += StackPanel_MouseLeave; border.MouseLeftButtonDown += Border_MouseLeftButtonDown; border.CornerRadius = new CornerRadius(3); border.Background = new SolidColorBrush(Color.FromRgb(115, 120, 125)); StackPanel sp = new StackPanel(); sp.Margin = new Thickness(20); border.Child = sp; sp.Orientation = Orientation.Vertical; TextBlock tb = new TextBlock(); tb.Text = strs[i]; tb.Foreground = new SolidColorBrush(Colors.White); tb.FontSize = 18; sp.Children.Add(tb); wpMain.Children.Add(border); } }
/// <summary> /// 初始化静态常量 /// </summary> public void InitStaticConstant() { StaticConstant.mw = view; String strColortabPath = AppDomain.CurrentDomain.BaseDirectory + @"Color\color.color"; StaticConstant.brushList = FileBusiness.CreateInstance().ReadColorFile(strColortabPath); }
public List <String> GetFile(FileType fileType) { switch (fileType) { case FileType.Light: return(FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "Light", new List <string>() { ".light", ".mid" })); case FileType.LightScript: return(FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "LightScript", new List <string>() { ".lightScript" })); case FileType.LimitlessLamp: return(FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "LimitlessLamp", new List <string>() { ".limitlessLamp" })); case FileType.Play: return(FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "Play", new List <string>() { ".lightPage" })); default: return(null); } }
public void StartTutorial() { if (FileUtils.tutorialParagraphLightIntList == null) { FileUtils.tutorialParagraphLightIntList = new List <List <int> >(); } FileUtils.tutorialPosition = 0; FileUtils.tutorialParagraphLightIntList.Clear(); foreach (var item in FileUtils.oldTutorialParagraphLightIntList) { List <int> ints = new List <int>(); for (int i = 0; i < item.Count; i++) { ints.Add(item[i]); } FileUtils.tutorialParagraphLightIntList.Add(ints); } if (FileUtils.sendLight != null) { List <Light> ll = new List <Light>(); for (int j = 0; j < FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition].Count; j++) { ll.Add(new Light(0, 144, FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition][j], 3)); } FileBusiness.CreateInstance().ReplaceControl(ll, FileBusiness.CreateInstance().midiArr); FileUtils.sendLight(ll); } }
/// <summary> /// /// </summary> /// <param name="window"></param> /// <param name="hint"></param> /// <param name="notContains"></param> /// <param name="fileType"></param> public GetStringDialog3(Window window, String TheFolder) { InitializeComponent(); Owner = window; this.window = window; directorys = FileBusiness.CreateInstance().GetDirectorysName(TheFolder); }
/// <summary> /// /// </summary> /// <param name="window"></param> /// <param name="hint"></param> /// <param name="notContains"></param> /// <param name="fileType"></param> public NewProjectWindowDialog(Window window, String TheFolder, bool isClose) { InitializeComponent(); Owner = window; this.window = window; this.isClose = isClose; directorys = FileBusiness.CreateInstance().GetDirectorysName(TheFolder); }
private void LoadFileList() { lbMain.Items.Clear(); BaseUserControl baseUserControl = gMain.Children[0] as BaseUserControl; List <String> fileNames = FileBusiness.CreateInstance().GetFilesName(baseUserControl.GetFileDirectory(), new List <string>() { baseUserControl._fileExtension }); for (int i = 0; i < fileNames.Count; i++) { lbMain.Items.Add(fileNames[i]); } }
protected override void LoadFileContent() { DeviceModel deviceModel = FileBusiness.CreateInstance().LoadDeviceModel(filePath); GeneralOtherViewBusiness.SetLaunchpadStyle(mLaunchpad, deviceModel); if (deviceModel.Equals("Launchpad Pro")) { cbDeviceType.SelectedIndex = 0; } tbBackGround.Text = deviceModel.DeviceBackGroundStr; tbBackGround.Background = deviceModel.DeviceBackGround; tbDeviceSize.Text = deviceModel.DeviceSize.ToString(); if (deviceModel.IsMembrane) { cbMembrane.IsChecked = true; } }
private void ReplaceLight(object sender, RoutedEventArgs e) { if (tbCount.Text.Equals("0")) { return; } List <String> fileNames = new List <string>(); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(mw.lastProjectPath + @"\Light", new List <string>() { ".light" })); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(mw.lastProjectPath + @"\LightScript", new List <string>() { ".lightScript" })); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(mw.lastProjectPath + @"\Midi", new List <string>() { ".mid" })); ShowLightListDialog dialog = new ShowLightListDialog(mw, tbLightName.Text, fileNames); if (dialog.ShowDialog() == true) { tbLightName.Text = dialog.selectItem; //int position = int.Parse(tbPosition.Text) - 28; //if (nowSelectType == PageUCSelectType.Down) { // _pageModes[position][int.Parse(tbCount.Text) - 1]._down._lightName = dialog.selectItem; //} //else if (nowSelectType == PageUCSelectType.Loop) //{ // _pageModes[position][int.Parse(tbCount.Text) - 1]._loop._lightName = dialog.selectItem; //} //else if (nowSelectType == PageUCSelectType.Up) //{ // _pageModes[position][int.Parse(tbCount.Text) - 1]._up._lightName = dialog.selectItem; //} //if (!_gotos[position].Equals("")) //{ // mLaunchpad.SetButtonBackground(position, new SolidColorBrush(Color.FromArgb(255, 255, 0, 255))); //} //else { // mLaunchpad.SetButtonBackground(position, new SolidColorBrush(Color.FromArgb(255, 255, 0, 0))); //} } }
private void LoadTutorial(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); openFileDialog1.Filter = "MIDI文件|*.mid;*.midi"; //openFileDialog1.Filter = _fileExtension.Substring(1) + "文件(*" + _fileExtension + ")|*" + _fileExtension + "|All files(*.*)|*.*"; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List <Light> tutorialLightList = FileBusiness.CreateInstance().ReadMidiFile(openFileDialog1.FileName); FileUtils.oldTutorialParagraphLightIntList = LightBusiness.GetParagraphLightIntListList(tutorialLightList); if (FileUtils.oldTutorialParagraphLightIntList.Count == 0) { FileUtils.tutorialParagraphLightIntList = null; } StartTutorial(); } }
private void ButtonOfOpen_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); DialogResult dr = fbd.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { //获得路径 directoryPath = fbd.SelectedPath; musicFileNames = FileBusiness.CreateInstance().GetFilesName(directoryPath, new List <string>() { ".mp3", ".mav" }); if (musicFileNames.Count > 0) { player.Open(new Uri(directoryPath + @"\" + musicFileNames[0], UriKind.RelativeOrAbsolute)); } } }
public My3DUserControl(NewMainWindow mw, List <Operation.Light> mLightList) { InitializeComponent(); this.mw = mw; this.mLightList = mLightList; FileBusiness.CreateInstance().ReplaceControl(this.mLightList, FileBusiness.CreateInstance().midiArr); for (int i = mLightList.Count - 1; i >= 0; i--) { if (mLightList[i].Position < 36 || mLightList[i].Position > 99) { mLightList.Remove(mLightList[i]); } } worker.WorkerReportsProgress = true; worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += worker_ProgressChanged; worker.WorkerSupportsCancellation = true; SetData(mLightList); }
public void OnInput(int position, InputAndOutputControlEnum.KeyModel keyModel) { if (FileUtils.tutorialParagraphLightIntList.Count > FileUtils.tutorialPosition) { if (keyModel == InputAndOutputControlEnum.KeyModel.KeyDown) { if (FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition].Contains(position)) { FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition].Remove((int)position); List <Light> ll = new List <Light>() { new Light(0, 128, position, 64) }; FileBusiness.CreateInstance().ReplaceControl(ll, FileBusiness.CreateInstance().midiArr); if (FileUtils.sendLight != null) { FileUtils.sendLight(ll); } } if (FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition].Count == 0) { FileUtils.tutorialPosition++; FileUtils.tutorialPosition = FileUtils.tutorialPosition % FileUtils.tutorialParagraphLightIntList.Count; List <Light> ll = new List <Light>(); for (int j = 0; j < FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition].Count; j++) { ll.Add(new Light(0, 144, FileUtils.tutorialParagraphLightIntList[FileUtils.tutorialPosition][j], 3)); } FileBusiness.CreateInstance().ReplaceControl(ll, FileBusiness.CreateInstance().midiArr); FileUtils.sendLight(ll); } } } }
private void InitProject() { List <String> strs = FileBusiness.CreateInstance().GetDirectorysName(AppDomain.CurrentDomain.BaseDirectory + @"\Project"); //GeneralViewBusiness.SetStringsToListBox(lbProject, strs, projectConfigModel.Path); int width = (int)Math.Floor(((spCenter.Width - 75) / 4.0)); int height = (int)(width / 4.0 * 3); for (int i = 0; i < strs.Count; i++) { Border border = new Border(); border.Width = width; border.Height = height; border.Background = new SolidColorBrush(Colors.Transparent); border.MouseLeftButtonDown += Border_MouseLeftButtonDown; border.CornerRadius = new CornerRadius(3); border.BorderThickness = new Thickness(2); border.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85)); border.Margin = new Thickness(15, 15, 0, 0); if (i > strs.Count - 5) { border.Margin = new Thickness(15, 15, 0, 15); } Grid grid = new Grid(); border.Child = grid; TextBlock tb = new TextBlock(); tb.HorizontalAlignment = HorizontalAlignment.Center; tb.VerticalAlignment = VerticalAlignment.Center; tb.Text = strs[i]; tb.FontSize = 17; tb.Margin = new Thickness(15); tb.Foreground = new SolidColorBrush(Color.FromRgb(184, 191, 198)); grid.Children.Add(tb); wpProject.Children.Add(border); } SetSpFilePosition(strs.IndexOf(mw.projectConfigModel.Path)); }
private void btnSelectFile_Click(object sender, RoutedEventArgs e) { List <String> fileNames = new List <string>(); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(mw.lastProjectPath + @"\Light", new List <string>() { ".light" })); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(mw.lastProjectPath + @"\LightScript", new List <string>() { ".lightScript" })); fileNames.AddRange(FileBusiness.CreateInstance().GetFilesName(mw.lastProjectPath + @"\Midi", new List <string>() { ".mid" })); ShowLightListDialog dialog = new ShowLightListDialog(mw, tbTutorialPath.Text, fileNames); if (dialog.ShowDialog() == true) { tbTutorialPath.Text = dialog.selectItem; mw.tutorial = tbTutorialPath.Text; } }
/// <summary> /// 初始化数据 /// </summary> public void SetData(NewMainWindow mw) { this.mw = mw; //格式 if (mw.projectUserControl.suc.strInputFormatDelimiter.Equals("Comma")) { rbInputFormatDelimiterComma.IsChecked = true; } else if (mw.projectUserControl.suc.strInputFormatDelimiter.Equals("Space")) { rbInputFormatDelimiterSpace.IsChecked = true; } if (mw.projectUserControl.suc.strInputFormatRange.Equals("Shortbar")) { rbInputFormatRangeShortbar.IsChecked = true; } else if (mw.projectUserControl.suc.strInputFormatRange.Equals("R")) { rbInputFormatRangeR.IsChecked = true; } ////其他画图软件路径 //if (mw.strToolOtherDrawingSoftwarePath.Equals("")) //{ // if (mw.strMyLanguage.Equals("zh-CN")) { // tbToolOtherDrawingSoftwarePath.Text = "未定位"; // } // else if(mw.strMyLanguage.Equals("en-US")) { // tbToolOtherDrawingSoftwarePath.Text = "No Location"; // } //} //else //{ // tbToolOtherDrawingSoftwarePath.Text = mw.strToolOtherDrawingSoftwarePath; //} ////颜色表路径 //if (mw.strColortabPath.Equals("")) //{ // if (mw.strMyLanguage.Equals("zh-CN")) // { // tbColortabPath.Text = "未定位"; // } // else if (mw.strMyLanguage.Equals("en-US")) // { // tbColortabPath.Text = "No Location"; // } //} //else //{ // tbColortabPath.Text = mw.strColortabPath; //} //测试 sOpacity.Value = mw.testConfigModel.Opacity; //版本 //tbNowVersion.Text = mw.versionConfigModel.NowVersion; //平铺 tbPavedColumns.Text = mw.pavedConfigModel.Columns.ToString(); tbPavedMax.Text = mw.pavedConfigModel.Max.ToString(); //帮助 tbHelpExeFilePath.Text = mw.helpConfigModel.ExeFilePath.ToString(); //播放器 //播放器 - 类型 switch (mw.playerType) { case PlayerType.ParagraphLightList: rbParagraphLightList.IsChecked = true; break; case PlayerType.Accurate: rbAccurate.IsChecked = true; break; case PlayerType.ParagraphIntList: rbParagraphIntList.IsChecked = true; break; } //播放器 - 默认 GeneralOtherViewBusiness.SetStringsToListBox(lbMain, FileBusiness.CreateInstance().GetFilesName(AppDomain.CurrentDomain.BaseDirectory + @"\Device", new List <String>() { ".ini" }), mw.playerDefault); }
/// <summary> /// 添加文件 /// </summary> public virtual void NewFile(object sender, RoutedEventArgs e) { String _filePath = GetFileDirectory(); if (pop == null) { UI.Pop.NewFileDialog newFileDialog = new UI.Pop.NewFileDialog(mw, false, _fileExtension, FileBusiness.CreateInstance().GetFilesName(filePath, new List <string>() { _fileExtension }), _fileType, "", NewFileResult); pop = new Popup(); pop.StaysOpen = false; pop.Child = newFileDialog; pop.Placement = PlacementMode.Center; mw.gRight.Children.Add(pop); pop.HorizontalAlignment = HorizontalAlignment.Center; pop.VerticalAlignment = VerticalAlignment.Top; } pop.IsOpen = true; }
public void InitFile() { tvLight.Items.Clear(); tvLightScript.Items.Clear(); tvLimitlessLamp.Items.Clear(); tvPage.Items.Clear(); foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "Light", new List <string>() { ".light", ".mid" })) { TreeViewItem item = new TreeViewItem { Header = str, }; item.FontSize = 16; item.ContextMenu = contextMenu; item.HorizontalContentAlignment = HorizontalAlignment.Left; item.VerticalContentAlignment = VerticalAlignment.Center; tvLight.Items.Add(item); } foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "LightScript", new List <string>() { ".lightScript" })) { TreeViewItem item = new TreeViewItem { Header = str, }; item.FontSize = 16; item.ContextMenu = contextMenu; item.HorizontalContentAlignment = HorizontalAlignment.Left; item.VerticalContentAlignment = VerticalAlignment.Center; tvLightScript.Items.Add(item); } foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "LimitlessLamp", new List <string>() { ".limitlessLamp" })) { TreeViewItem item = new TreeViewItem { Header = str, }; item.FontSize = 16; item.ContextMenu = contextMenu; item.HorizontalContentAlignment = HorizontalAlignment.Left; item.VerticalContentAlignment = VerticalAlignment.Center; tvLimitlessLamp.Items.Add(item); } foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "Play", new List <string>() { ".lightPage" })) { TreeViewItem item = new TreeViewItem { Header = str, }; item.FontSize = 16; item.ContextMenu = contextMenu; item.HorizontalContentAlignment = HorizontalAlignment.Left; item.VerticalContentAlignment = VerticalAlignment.Center; tvPage.Items.Add(item); } if (!File.Exists(mw.LastProjectPath + @"Play\" + mw.projectConfigModel.Path + ".playExport")) { mw.editUserControl.peuc.NewFileResult2(mw.projectConfigModel.Path + ".playExport"); } if (tviPlayExport == null) { tviPlayExport = new TreeViewItem { Header = mw.projectConfigModel.Path + ".playExport", }; tviPlayExport.FontSize = 16; tviPlayExport.ContextMenu = contextMenu; tviPlayExport.HorizontalContentAlignment = HorizontalAlignment.Left; tviPlayExport.VerticalContentAlignment = VerticalAlignment.Center; tvMain.Items.Add(tviPlayExport); } }
private void RenameFileName(object sender, RoutedEventArgs e) { GetNeedControl(sender); BaseUserControl baseUserControl = null; if (!needControlFileName.EndsWith(".lightScript")) { for (int i = 0; i < mw.editUserControl.userControls.Count; i++) { if (needControlFileName.EndsWith(mw.editUserControl.userControls[i]._fileExtension)) { baseUserControl = mw.editUserControl.userControls[i]; break; } } } else { baseUserControl = mw.editUserControl.userControls[3] as BaseUserControl; } if (baseUserControl == null) { return; } needControlBaseUserControl = baseUserControl; baseUserControl.filePath = needControlFileName; String _filePath = baseUserControl.GetFileDirectory(); UserControlDialog.NewFileDialog newFileDialog = new UserControlDialog.NewFileDialog(mw, true, baseUserControl._fileExtension, FileBusiness.CreateInstance().GetFilesName(baseUserControl.filePath, new List <string>() { baseUserControl._fileExtension }), baseUserControl._fileExtension, "", NewFileResult); mw.ShowMakerDialog(newFileDialog); }
public void RefreshFile(int position) { lbFile.Items.Clear(); if (position == 0) { foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "Light", new List <string>() { ".light", ".mid" })) { ListBoxItem item = new ListBoxItem { Content = str, }; item.ContextMenu = contextMenu; item.PreviewMouseLeftButtonDown += Item_MouseLeftButtonDown; lbFile.Items.Add(item); } } if (position == 1) { foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "LightScript", new List <string>() { ".lightScript" })) { ListBoxItem item = new ListBoxItem { Content = str }; item.ContextMenu = contextMenu; item.PreviewMouseLeftButtonDown += Item_MouseLeftButtonDown; lbFile.Items.Add(item); } } if (position == 2) { foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "LimitlessLamp", new List <string>() { ".limitlessLamp" })) { ListBoxItem item = new ListBoxItem { Content = str }; item.ContextMenu = contextMenu; item.PreviewMouseLeftButtonDown += Item_MouseLeftButtonDown; lbFile.Items.Add(item); } } if (position == 3) { foreach (String str in FileBusiness.CreateInstance().GetFilesName(mw.LastProjectPath + "Play", new List <string>() { ".lightPage" })) { ListBoxItem item = new ListBoxItem { Content = str }; item.ContextMenu = contextMenu; item.PreviewMouseLeftButtonDown += Item_MouseLeftButtonDown; lbFile.Items.Add(item); } } }