public static string ReportReadDiagram(string game, double width, double height, bool background) { try { string strTempFile = AppDomain.CurrentDomain.BaseDirectory + "Diagram.Dia"; if (System.IO.File.Exists(game)) { Drawing draw = Drawing.Load(game, new Canvas()); Diagram dia = new Diagram(draw); Diagram.DiagramSize = new System.Windows.Size(width, height); dia.TranslateToDiagram(strTempFile, background); } return strTempFile; } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); return null; } }
public void LoadDrawing(string strFile) { CloseDrawing(); if (!System.IO.File.Exists(strFile)) { Drawing = new Webb.Playbook.Geometry.Drawing(Canvas); } else { Drawing = Draw.Load(strFile, Canvas); } Drawing.Playground.UCPlayground.Visibility = Visibility.Hidden; Drawing.SetDefaultBehavior(); }
public AnimationWindow(string path) : this() { OriDrawing = Draw.Load(path, canvasDrawing); OriDrawing.Behavior = null; }
public static System.Data.DataTable ReportReadData(string[] games) { DataTable table = new DataTable(); table.Columns.Add("FileName", typeof(string)); table.Columns.Add("FilePath", typeof(string)); table.Columns.Add("PlayerName", typeof(string)); table.Columns.Add("SymbolName", typeof(string)); table.Columns.Add("PlayerCoachingPoints", typeof(string)); table.Columns.Add("PlayerScoutType", typeof(Data.ScoutTypes)); table.Columns.Add("ImagePath", typeof(string)); try { Canvas canvas = new Canvas(); Drawing drawing = null; foreach (string game in games) { string gamePath = new System.IO.FileInfo(game).FullName; if (System.IO.File.Exists(gamePath)) { drawing = Drawing.Load(gamePath, canvas); IEnumerable<Game.PBPlayer> players = drawing.Figures.OfType<Game.PBPlayer>(); foreach (Game.PBPlayer player in players) { DataRow row = table.NewRow(); row[0] = System.IO.Path.GetFileNameWithoutExtension(gamePath); row[1] = gamePath; row[2] = player.Name; row[3] = player.Text; row[4] = player.CoachingPoints; row[5] = player.ScoutType; // 08-18-2011 Scott if (!System.IO.Directory.Exists(gamePath + ".BMP")) { row[6] = gamePath + ".BMP"; } else { row[6] = string.Empty; } //string basePath = string.Empty; //string productKeyPath = @"SOFTWARE\Webb Electronics\Playbook"; //Microsoft.Win32.RegistryKey productKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(productKeyPath); //if (productKey != null) //{ // object objDir = productKey.GetValue("InstallDir"); // if (objDir != null) // { // basePath = objDir.ToString(); // } //} //if (!System.IO.Directory.Exists(basePath)) //{ // break; //} //string path = basePath + @"\Bitmaps\"; //if (gamePath.Contains(basePath + @"Offensive\Formation\Offensive") // || gamePath.Contains(basePath + @"Defensive\Formation\Offensive")) //{ // path += "Offense"; //} //else if (gamePath.Contains(basePath + @"Offensive\Formation\Defensive") // || gamePath.Contains(basePath + @"Defensive\Formation\Defensive")) //{ // path += "Defense"; //} //else if (gamePath.Contains(basePath + @"Offensive\Playbook") // || gamePath.Contains(basePath + @"Defensive\Playbook")) //{ // path += "Plays"; //} //string[] arrBitmaps = System.IO.Directory.GetFiles(path, row[0].ToString() + ".bmp", System.IO.SearchOption.AllDirectories); //if (arrBitmaps != null && arrBitmaps.Count() > 0) //{ // row[6] = arrBitmaps[0]; //} //else //{ // row[6] = string.Empty; //} table.Rows.Add(row); } } } } catch (Exception ex) { System.Windows.MessageBox.Show("Source:\n" + ex.Source + "\n\n" + "Message:\n" + ex.Message + "\n\n" + "StackTrace:\n" + ex.StackTrace, "Webb Trace"); } return table; }