/// <summary> /// エクスポート処理 /// </summary> /// <param name="WorkArea"></param> /// <returns></returns> public bool Export(IWorkArea WorkArea) { var sb = new StringBuilder(); var exists = false; sb.Append(@"http://www.x4-game.com/#/station-calculator?"); // モジュール情報を追加 sb.Append("l=@"); var modules = WorkArea.StationData.ModulesInfo.Modules .Where(x => x.Module.ModuleType.ModuleTypeID != "connectionmodule" && x.Module.ModuleType.ModuleTypeID != "ventureplatform" && x.Module.ID != "module_gen_dock_m_venturer_01"); foreach (var module in modules) { sb.Append($"$module-{module.Module.ID},count:{module.ModuleCount};,"); exists = true; } if (exists) { sb.Length -= 2; } SelectStringDialog.ShowDialog("Lang:StationCalculatorExport_Title", "Lang:StationCalculatorExport_Description", sb.ToString(), hideCancelButton: true); return(true); }
/// <summary> /// レイアウト保存 /// </summary> public void SaveLayout(WorkAreaViewModel?vm) { if (vm != null) { var(onOK, layoutName) = SelectStringDialog.ShowDialog("Lang:EditLayoutName", "Lang:LayoutName", "", IsValidLayoutName); if (onOK) { try { SettingDatabase.Instance.BeginTransaction(); var layoutID = vm.SaveLayout(layoutName); SettingDatabase.Instance.Commit(); Layouts.Add(new LayoutMenuItem(layoutID, layoutName, false)); } catch (Exception ex) { SettingDatabase.Instance.Rollback(); LocalizedMessageBox.Show("Lang:LayoutSaveFailedMessage", "Lang:Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, ex.Message); } LocalizedMessageBox.Show("Lang:LayoutSavedMessage", "Lang:Confirmation", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, vm.Title, layoutName); } } else { LocalizedMessageBox.Show("Lang:TabDoesNotSelectedMessage", "Lang:Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); } }
/// <summary> /// レイアウト名変更 /// </summary> private void EditLayoutName(LayoutMenuItem menuItem) { var(onOK, newLayoutName) = SelectStringDialog.ShowDialog("Lang:EditLayoutName", "Lang:LayoutName", menuItem.LayoutName.Value, IsValidLayoutName); if (onOK && menuItem.LayoutName.Value != newLayoutName) { menuItem.LayoutName.Value = newLayoutName; var param = new SQLiteCommandParameters(2); param.Add("layoutName", System.Data.DbType.String, menuItem.LayoutName.Value); param.Add("layoutID", System.Data.DbType.Int32, menuItem.LayoutID); SettingDatabase.Instance.ExecQuery($"UPDATE WorkAreaLayouts SET LayoutName = :layoutName WHERE LayoutID = :layoutID", param); } }