406 |
406 |
407 if ((Panel1 != null && Panel1.Project.Equals(newProject)) || (Panel2 != null && Panel2.Project.Equals(newProject)) || (Panel3 != null && Panel3.Project.Equals(newProject)) || (Panel4 != null && Panel4.Project.Equals(newProject))) |
407 if ((Panel1 != null && Panel1.Project.Equals(newProject)) || (Panel2 != null && Panel2.Project.Equals(newProject)) || (Panel3 != null && Panel3.Project.Equals(newProject)) || (Panel4 != null && Panel4.Project.Equals(newProject))) |
408 return; |
408 return; |
409 |
409 |
410 Random c = new Random(); |
410 Random c = new Random(); |
411 int color = c.Next(12); |
411 uint color = (uint)c.Next(12) + 1; // for the number to be >0 |
412 switch (((UserControlScreen)sender).id) |
412 switch (((UserControlScreen)sender).id) |
413 { |
413 { |
414 case 1: |
414 case 1: |
415 UserControlPivot.ApplyColor(1, "Color_" + color); |
415 UserControlPivot.ApplyColor(1, color); |
416 Panel1 = new UserControlUserPanel(1, 0xFF5A0FC8, newProject, _mainviewmodel.Session.VideoPath); |
416 Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
417 Panel1.Name = "UserPanel1"; |
417 Panel1.Name = "UserPanel1"; |
418 //3-Rajout sur la Grid Root |
418 //3-Rajout sur la Grid Root |
419 root.Children.Add(Panel1); |
419 root.Children.Add(Panel1); |
420 break; |
420 break; |
421 case 2: |
421 case 2: |
422 UserControlPivot.ApplyColor(2, "Color_" + color); |
422 UserControlPivot.ApplyColor(2, color); |
423 Panel2 = new UserControlUserPanel(2, 0xFFC80FA0, newProject, _mainviewmodel.Session.VideoPath); |
423 Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
424 Panel2.Name = "UserPanel2"; |
424 Panel2.Name = "UserPanel2"; |
425 //3-Rajout sur la Grid Root |
425 //3-Rajout sur la Grid Root |
426 root.Children.Add(Panel2); |
426 root.Children.Add(Panel2); |
427 break; |
427 break; |
428 case 3: |
428 case 3: |
429 UserControlPivot.ApplyColor(3, "Color_" + color); |
429 UserControlPivot.ApplyColor(3, color); |
430 Panel3 = new UserControlUserPanel(3, 0xFFFFFF00, newProject, _mainviewmodel.Session.VideoPath); |
430 Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
431 Panel3.Name = "UserPanel3"; |
431 Panel3.Name = "UserPanel3"; |
432 //3-Rajout sur la Grid Root |
432 //3-Rajout sur la Grid Root |
433 root.Children.Add(Panel3); |
433 root.Children.Add(Panel3); |
434 break; |
434 break; |
435 case 4: |
435 case 4: |
436 UserControlPivot.ApplyColor(4, "Color_" + color); |
436 UserControlPivot.ApplyColor(4, color); |
437 Panel4 = new UserControlUserPanel(4, 0xFF0096FF, newProject, _mainviewmodel.Session.VideoPath); |
437 Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
438 Panel4.Name = "UserPanel4"; |
438 Panel4.Name = "UserPanel4"; |
439 //3-Rajout sur la Grid Root |
439 //3-Rajout sur la Grid Root |
440 root.Children.Add(Panel4); |
440 root.Children.Add(Panel4); |
441 break; |
441 break; |
442 } |
442 } |
452 if(e.Confirmed==true) |
452 if(e.Confirmed==true) |
453 { |
453 { |
454 switch(e.PanelNumber) |
454 switch(e.PanelNumber) |
455 { |
455 { |
456 case 1: |
456 case 1: |
457 UserControlPivot.ApplyColor(1, "Default"); |
457 UserControlPivot.ApplyColor(1, 0); |
458 root.Children.Remove(Panel1); |
458 root.Children.Remove(Panel1); |
459 Panel1 = null; |
459 Panel1 = null; |
460 break; |
460 break; |
461 case 2: |
461 case 2: |
462 UserControlPivot.ApplyColor(2, "Default"); |
462 UserControlPivot.ApplyColor(2, 0); |
463 root.Children.Remove(Panel2); |
463 root.Children.Remove(Panel2); |
464 Panel2 = null; |
464 Panel2 = null; |
465 break; |
465 break; |
466 case 3: |
466 case 3: |
467 UserControlPivot.ApplyColor(3, "Default"); |
467 UserControlPivot.ApplyColor(3, 0); |
468 root.Children.Remove(Panel3); |
468 root.Children.Remove(Panel3); |
469 Panel3 = null; |
469 Panel3 = null; |
470 break; |
470 break; |
471 case 4: |
471 case 4: |
472 UserControlPivot.ApplyColor(4, "Default"); |
472 UserControlPivot.ApplyColor(4, 0); |
473 root.Children.Remove(Panel4); |
473 root.Children.Remove(Panel4); |
474 Panel4 = null; |
474 Panel4 = null; |
475 break; |
475 break; |
476 } |
476 } |
477 } |
477 } |