public void ArgumentCreateDateIsDefault() { var result = new DateTime(2000, 1, 1).Date; var mock = this.mock(result, new DateTime(1990, 1, 1), new DateTime(2100, 1, 10).Date.ToString()); ContentCreator.ReleaseDate(mock.Object).Is(result); }
public async void LoginContentCreator() { try { if (textBox_Email.Text != "" && passwordBox_Password.Password != "") { try { ContentCreator ContentCreatorLog = await Session.serverConnection.contentCreatorService.LoginContentCreatorAsync(textBox_Email.Text, passwordBox_Password.Password); if (ContentCreatorLog != null) { Session.contentCreator = ContentCreatorLog; ContentCreatorMain mainWindowCC = new ContentCreatorMain(); mainWindowCC.Show(); this.Close(); } } catch (NullReferenceException ex) { textBlock_Message.Text = "*Service error, please close and try again"; Console.WriteLine(ex + " in Login LoginContentCreator"); } } else { textBlock_Message.Text = "*Complete all fields"; } } catch (Exception ex) { textBlock_Message.Text = "*Email or password are wrong"; Console.WriteLine(ex + " in Login LoginContentCreator"); } }
public void ArgumentNormal() { var result = new DateTime(2000, 1, 1).Date; var mock = this.mock(null, new DateTime(), result.ToString()); ContentCreator.ReleaseDate(mock.Object).Is(result); }
private async Task <bool> AddToLibrary() { bool result = true; if (datagrid_SearchAlbums.SelectedItem != null) { Album albumAux = (Album)datagrid_SearchAlbums.SelectedItem; await Session.serverConnection.albumService.AddAlbumToLibraryAsync(Session.library.IdLibrary, albumAux.IdAlbum); } else if (datagrid_SearchContentCreators.SelectedItem != null) { ContentCreator contentCreatorAux = (ContentCreator)datagrid_SearchContentCreators.SelectedItem; await Session.serverConnection.contentCreatorService.AddContentCreatorToLibraryAsync(Session.library.IdLibrary, contentCreatorAux.IdContentCreator); } else if (datagrid_SearchPlaylists.SelectedItem != null) { Playlist playlistAux = (Playlist)datagrid_SearchPlaylists.SelectedItem; await Session.serverConnection.playlistService.AddPlaylistToLibraryAsync(Session.library.IdLibrary, playlistAux.IdPlaylist); } else if (datagrid_SearchTracks.SelectedItem != null) { Track trackAux = (Track)datagrid_SearchTracks.SelectedItem; await Session.serverConnection.trackService.AddTrackToLibraryAsync(Session.library.IdLibrary, trackAux.IdTrack); } else { result = false; } return(result); }
public void Serialize(ContentViewer control, DataStore data) { SerializeDefault(control); brush.Serialize(control, control.Background, data); content = control.contentCreator; horizontalAlignment = control.HorizontalContentAlignment; verticalAlignment = control.VerticalContentAlignment; }
public void Serialize(ToggleButton_Control control, DataStore data) { SerializeDefault(control); DefaultIsChecked = control.DefaultIsChecked; actionU = new List <IActions>(control.UncheckedActions); actionC = new List <IActions>(control.CheckedActions); keyN = control.keyN; keyC = control.keyC; stretchN = control.stretchN; stretchC = control.stretchC; contentCH = control.contentCreatorChecked; contentUN = control.contentCreatorUnchecked; CornerRadius = control.CBorder.CornerRadius.TopLeft; if (control.CheckedBrush is ImageBrush) { control.Tag = SaveEditor.SerializeObject(new DesignSave(new ImageRepresentation(control.keyC, ((ImageBrush)control.CheckedBrush).Stretch))); } brush.Serialize(control, control.CheckedBrush, data); if (control.UncheckedBrush is ImageBrush) { control.Tag = SaveEditor.SerializeObject(new DesignSave(new ImageRepresentation(control.keyN, ((ImageBrush)control.UncheckedBrush).Stretch))); } brushUN.Serialize(control, control.UncheckedBrush, data); control.Tag = null; opacity = control.OpacityN; opacityhover = control.OpacityHover; opacityclick = control.OpacityClick; if (control.ToolTip != null) { Tooltip = control.ToolTip.ToString(); } horizontalAlignment = control.Ccontent.HorizontalAlignment; verticalAlignment = control.Ccontent.VerticalAlignment; DoAnimation = control.DoAnimation; if (control.Cursor != null) { ChangeCursor = true; } else { ChangeCursor = false; } }
public SingUp() { InitializeComponent(); newConsumer = new Consumer(); newContentCreator = new ContentCreator(); textBlock_StageName.Visibility = Visibility.Hidden; textBox_StageName.Visibility = Visibility.Hidden; button_SignUp.Visibility = Visibility.Hidden; }
// Use this for initialization void Awake() { if (!Instance) { Instance = this; } else { Destroy(gameObject); } }
public void ArgumentAllBlankOrDefault() { DateTime?releaseDate = null; var mock = new Mock <IContent>(); mock.Setup(m => m.ReleaseDate).Returns(releaseDate); mock.Setup(m => m.CreateDate).Returns(new DateTime()); mock.Setup(m => m.GetValue <string>(VelstandProperty.ReleaseDate)).Returns(string.Empty); ContentCreator.ReleaseDate(mock.Object).Date.Is(DateTime.Now.Date); }
public static bool SingIn(AuthData user) { var content = ContentCreator.CreateContent(user); HttpResponseMessage response = AdressList.GetHttpClient().PostAsync(AdressList.SingIn, content).Result; if (response.StatusCode == HttpStatusCode.OK) { MainUserCreator.PutUserToSystem(response); SaveService.SaveUser(user); return(true); } DialogMessage.ShowInfo("Logowanie nieudane!"); return(false); }
public static bool SingUp(AuthData user) { var content = ContentCreator.CreateContent(user); HttpResponseMessage response = AdressList.GetHttpClient().PostAsync(AdressList.SingUp, content).Result; if (response.StatusCode == HttpStatusCode.Created) { NotifitactionForm.ShowMessage("Użytkownik zarejestrowany!"); return(true); } DialogMessage.ShowInfo("Rejestracja nieudana!"); return(false); }
public async Task <IActionResult> DeleteContentCreator([FromBody] ContentCreator contentCreator) { var collectionArticles = db.GetCollection <Article>("Article"); var collectionComments = db.GetCollection <Comment>("Comment"); var articleList = collectionArticles.Find(x => x.PostedBy.Id == contentCreator.Id).ToList <Article>(); for (int k = 0; k < articleList.Count; k++) { await collectionComments.DeleteManyAsync(x => x.Article == articleList[k].Id); var collectionUsers = db.GetCollection <User>("User"); var userList = collectionUsers.Find(x => true).ToList <User>(); for (int i = 0; i < userList.Count; i++) { IList <Article> newReadList = new List <Article>(); IList <Article> newRecommendedList = new List <Article>(); IList <Article> readList = userList[i].Articles; IList <Article> recommendedList = userList[i].Recommended; for (int j = 0; j < readList.Count; j++) { if (readList[j].Id != articleList[k].Id) { newReadList.Add(readList[j]); } } var filterRead = Builders <User> .Filter.Eq(x => x.Id, userList[i].Id); var updateRead = Builders <User> .Update.Set(x => x.Articles, newReadList); collectionUsers.UpdateOne(filterRead, updateRead); for (int j = 0; j < recommendedList.Count; j++) { if (recommendedList[j].Id != articleList[k].Id) { newReadList.Add(recommendedList[j]); } } var filterRecommended = Builders <User> .Filter.Eq(x => x.Id, userList[i].Id); var updateRecommended = Builders <User> .Update.Set(x => x.Recommended, newReadList); collectionUsers.UpdateOne(filterRecommended, updateRecommended); } var collection = db.GetCollection <Article>("Article"); collection.DeleteOne(x => x.Id == articleList[k].Id); } return(Ok()); }
internal AdditionalCalculator(ItemsCreator temperatureCreator, ItemsCreator pressureCreator, ItemsCreator densityCreator, ItemsCreator capacityCreator, ItemsCreator contentCreator, ItemsCreator singleTagCreator) { this.temperatureCreator = temperatureCreator as TemperatureCreator; this.pressureCreator = pressureCreator as PressureCreator; this.densityCreator = densityCreator as DensityCreator; this.capacityCreator = capacityCreator as CapacityCreator; this.contentCreator = contentCreator as ContentCreator; this.singleTagCreator = singleTagCreator as SingleTagCreator; //Инициализируем расчет по расходу пропилена isInitPropyleneSuccess = InitalizePropyleneCalculations(); isInitDeltaPSuccess = InitalizeDeltaPCalculations(); InitalizePOPCalculations_T03_T06(); InitalizePOPCalculations_S13_P03(); InitalizePOPCalculations_T06_D08(); }
public async Task <IActionResult> AddContentCreator([FromBody] ContentCreator contentCreator) { var collection = db.GetCollection <ContentCreator>("ContentCreator"); var collection2 = db.GetCollection <User>("User"); if (collection.Find(x => x.Username == contentCreator.Username).FirstOrDefault() == null && collection2.Find(x => x.Username == contentCreator.Username).FirstOrDefault() == null) { collection.InsertOne(contentCreator); return(Ok()); } else { return(BadRequest("Username already exists!")); } }
public void SendComment(Comment comment) { HttpClient client = AdressList.GetHttpClient(); AdminAuthorization.SetAuthorization(client); var content = ContentCreator.CreateContent(comment); HttpResponseMessage response = client.PostAsync(AdressList.Comments, content).Result; if (response.StatusCode == HttpStatusCode.Created) { NotifitactionForm.ShowMessage("Wysłany element: " + "Komentarz"); } else { DialogMessage.ShowInfo("Błąd wysyłania elementu: " + "Komentarz"); } }
void Start() { Instance = this; elements = new List <ElementHandler>(); contentCreator = new ContentCreator(contentType, transform); for (int i = 0; i < transform.childCount; i++) { elements.Add(transform.GetChild(i).GetComponent <ElementHandler>()); } StartCoroutine("CalcuateOffsetValue"); }
private void Button_Add_Click(object sender, RoutedEventArgs e) { ContentCreator contentCreator = new ContentCreator(); DWindow_Content contentW = new DWindow_Content(data, contentCreator); contentW.ShowDialog(); if (contentW.IsOK == true) { ContentViewer cont = new ContentViewer(); cont.contentCreator = contentW.content; cont.Content = ""; cont.Content = cont.contentCreator.Create(data); cont.MaxHeight = 80; CB_Listbox.Items.Add(cont); } }
public static void ChangeUserRole(User user) { HttpClient client = AdressList.GetHttpClient(); AdminAuthorization.SetAuthorization(client); string patchUrl = AdressList.UsersAdmin + user.GetId() + "/update-role"; var content = ContentCreator.CreateContent(user.GetRole()); HttpResponseMessage response = client.SendAsync(new HttpRequestMessage(new HttpMethod("PATCH"), patchUrl) { Content = content }).Result; if (response.StatusCode != HttpStatusCode.OK) { DialogMessage.ShowInfo("Problem ze zmianą statusu!"); } else { NotifitactionForm.ShowMessage("Status zmieniony!"); } }
public static void ChangeArticleStatus(Article article) { HttpClient client = AdressList.GetHttpClient(); AdminAuthorization.SetAuthorization(client); string patchUrl = AdressList.ArticlesAdmin + "/" + article.GetId() + "/status"; var content = ContentCreator.CreateContent(article.GetStatus()); HttpResponseMessage response = client.SendAsync(new HttpRequestMessage(new HttpMethod("PATCH"), patchUrl) { Content = content }).Result; if (response.StatusCode != HttpStatusCode.OK) { DialogMessage.ShowInfo("Błąd zmiany statusu!"); } else { NotifitactionForm.ShowMessage("Status zmieniony!"); } }
public void Serialize(AnswerButton control, DataStore data) { if (control != null) { SerializeDefault(control); brush.Serialize(control, control.Background, data); brushSelect.SerializeWithKey(control.SelectedBrush, data, control.SelectedBrushKey); ID = control.ID; content = control.contentCreator; NormalOp = control.NormalOp; HoverOp = control.HoverOp; ClickOp = control.ClickOp; horizontalAlignment = control.AnswerPanel.HorizontalAlignment; verticalAlignment = control.AnswerPanel.VerticalAlignment; Good = control.Good; ShowGoodAnswer = control.ShowGood; } }
public static void Send(Movie movie) { var content = ContentCreator.CreateContent(movie); PostMethod(AdressList.MoviesAdmin, content, "Film"); }
private void Awake() { C8 = this; }
public static void Send(Article article) { var content = ContentCreator.CreateContent(article); PostMethod(AdressList.ArticlesAdmin, content, "Artykuł"); }
public void Serialize(CButton control, DataStore data) { SerializeDefault(control); action = new List <IActions>(control.actions); keyN = control.keyN; keyH = control.keyH; keyC = control.keyC; keyFor = control.keyFor; stretchN = control.stretchN; stretchH = control.stretchH; stretchC = control.stretchC; stretchFor = control.stretchFor; ChangeClick = control.ChangeClick; ChangeHover = control.ChangeHover; content = control.contentCreator; if (control.DefaultBrush is ImageBrush) { control.Tag = SaveEditor.SerializeObject(new DesignSave(new ImageRepresentation(control.keyN, ((ImageBrush)control.DefaultBrush).Stretch))); } brush.Serialize(control, control.DefaultBrush, data); if (control.Hover is ImageBrush) { control.Tag = SaveEditor.SerializeObject(new DesignSave(new ImageRepresentation(control.keyH, ((ImageBrush)control.Hover).Stretch))); } brushHover.Serialize(control, control.Hover, data); if (control.ClickBrush is ImageBrush) { control.Tag = SaveEditor.SerializeObject(new DesignSave(new ImageRepresentation(control.keyC, ((ImageBrush)control.ClickBrush).Stretch))); } brushClick.Serialize(control, control.ClickBrush, data); if (control.Foreground is ImageBrush) { control.Tag = SaveEditor.SerializeObject(new DesignSave(new ImageRepresentation(control.keyFor, ((ImageBrush)control.Foreground).Stretch))); } brushFor.Serialize(control, control.Foreground, data); control.Tag = null; opacity = control.OpacityN; opacityhover = control.OpacityHover; opacityclick = control.OpacityClick; if (control.ToolTip != null) { Tooltip = control.ToolTip.ToString(); } horizontalAlignment = control.HorizontalContentAlignment; verticalAlignment = control.VerticalContentAlignment; if (control.Cursor != null) { ChangeCursor = true; } else { ChangeCursor = false; } }
public async Task <ContentResponseMessage> SaveContent([FromBody] SaveContentRequestBody data) { if (!ModelState.IsValid) { return(ContentResponseMessage.CreateFrom(ModelState)); } var contentType = ContentTypeProvider.Get(data.ContentTypeId); var b = JsonConvert.DeserializeObject(data.Content, contentType.Type, PolymorphicFormConverter); if (!TryValidateModel(b)) { return(ContentResponseMessage.CreateFrom(ModelState)); } if (PrimaryKeyGetter.Get(b).All(id => id != null)) { var a = await ContentGetter.GetAsync(contentType.Id, PrimaryKeyConverter.Convert(data.KeyValues, contentType.Id)).ConfigureAwait(false); foreach (var coreInterface in ContentTypeCoreInterfaceProvider.GetFor(contentType.Id)) { foreach (var propertyDefinition in coreInterface.PropertyDefinitions) { var display = propertyDefinition.Attributes.OfType <DisplayAttribute>().FirstOrDefault(); if (display != null && display.GetAutoGenerateField() == false) { continue; } propertyDefinition.Setter(a, propertyDefinition.Getter(b)); } } foreach (var propertyDefinition in PropertyDefinitionProvider.GetFor(contentType.Id)) { var display = propertyDefinition.Attributes.OfType <DisplayAttribute>().FirstOrDefault(); if (display != null && display.GetAutoGenerateField() == false) { continue; } propertyDefinition.Setter(a, propertyDefinition.Getter(b)); } if (!TryValidateModel(b)) { throw new Exception("a was valid but b was not."); } await ContentUpdater.UpdateAsync(a).ConfigureAwait(false); return(new ContentResponseMessage(true, "Updated")); } else { await ContentCreator.CreateAsync(b).ConfigureAwait(false); return(new ContentResponseMessage(true, "Created")); } }
public AlbumsContentCreatorPage(ContentCreator contentCreator) { this.contentCreator = contentCreator; InitializeComponent(); GetAlbumByContentCreatorId(); }
public static void Send(Hall hall) { var content = ContentCreator.CreateContent(hall); PostMethod(AdressList.HallsAdmin, content, "Sala kinowa"); }
public DWindow_Content(DataStore dataStore, ContentCreator contentCreator) { InitializeComponent(); data = dataStore; content.contents = contentCreator.contents.ToList(); Debug.WriteLine("Count: " + content.contents.Count); foreach (Content_Default conD in content.contents) { SelectButton button = new SelectButton() { MinWidth = 10, MinHeight = 10, Background = new SolidColorBrush(Color.FromRgb(236, 240, 241)), DefaultBrush = new SolidColorBrush(Color.FromRgb(236, 240, 241)), Hover = new SolidColorBrush(Color.FromArgb(60, 233, 30, 99)), OnChecked = new SolidColorBrush(Color.FromRgb(240, 98, 146)) }; button.VerticalContentAlignment = VerticalAlignment.Center; if (conD.ContentType() == 0) { button.Content = new Image() { Source = data.archive.GetImage(((Content_Image)conD).ImageKey), Stretch = ((Content_Image)conD).stretch }; RenderOptions.SetBitmapScalingMode(button, ((Content_Image)conD).scalingMode); button.Width = ((Content_Image)conD).W; button.Height = ((Content_Image)conD).H; button.Margin = new Thickness(((Content_Image)conD).MarginLeft, 0, 0, 0); button.Tag = ((Content_Image)conD); } else if (conD.ContentType() == 1) { Content_Text text = (Content_Text)conD; button.Content = text.text; button.Margin = new Thickness(text.MarginLeft, 0, 0, 0); button.FontSize = text.fontsize; button.Tag = text; button.Foreground = text.foreground.DeserializeToBrushWithKey(data); if (text.fontFamily != null) { button.FontFamily = text.fontFamily; } if (text.Bold) { button.FontWeight = FontWeights.Bold; } if (text.Italic) { button.FontStyle = FontStyles.Italic; } } else if (conD.ContentType() == 2) { Content_Splitter spl = (Content_Splitter)conD; button.Margin = new Thickness(spl.MarginLeft, 0, 0, 0); button.Tag = spl; button.Content = new Rectangle() { Width = spl.W, Height = 1000, Fill = spl.fill.DeserializeToBrushWithKey(data) }; } else if (conD.ContentType() == 3) { Content_PageNumber acontent = (Content_PageNumber)conD; button.Content = (MainWindow.ActualPage + 1) - acontent.SubtractPages; button.Margin = new Thickness(acontent.MarginLeft, 0, 0, 0); button.FontSize = acontent.fontsize; button.Tag = acontent; button.Foreground = acontent.foreground.DeserializeToBrushWithKey(data); if (acontent.fontFamily != null) { button.FontFamily = acontent.fontFamily; } if (acontent.Bold) { button.FontWeight = FontWeights.Bold; } if (acontent.Italic) { button.FontStyle = FontStyles.Italic; } } else if (conD.ContentType() == 4) { Content_Answers acontent = (Content_Answers)conD; button.Content = "A"; button.Margin = new Thickness(acontent.MarginLeft, 0, 0, 0); button.FontSize = acontent.fontsize; button.Tag = acontent; button.Foreground = acontent.foreground.DeserializeToBrushWithKey(data); if (acontent.fontFamily != null) { button.FontFamily = acontent.fontFamily; } if (acontent.Bold) { button.FontWeight = FontWeights.Bold; } if (acontent.Italic) { button.FontStyle = FontStyles.Italic; } } else if (conD.ContentType() == 5) { Content_Date acontent = (Content_Date)conD; button.Content = acontent.Create(data).Content; button.Margin = new Thickness(acontent.MarginLeft, 0, 0, 0); button.FontSize = acontent.fontsize; button.Tag = acontent; button.Foreground = acontent.foreground.DeserializeToBrushWithKey(data); if (acontent.fontFamily != null) { button.FontFamily = acontent.fontFamily; } if (acontent.Bold) { button.FontWeight = FontWeights.Bold; } if (acontent.Italic) { button.FontStyle = FontStyles.Italic; } } ContentPanel.Children.Add(button); button.OnCheckChanged += Button_OnCheckChanged; } if (ContentPanel.Children.Count > 0) { ((SelectButton)ContentPanel.Children[0]).SetChecked(true); } }
public static void Send(Seance seance) { var content = ContentCreator.CreateContent(seance); PostMethod(AdressList.SeancesAdmin, content, "Seans"); }
public void AddLevel4Control(Point p) { switch (ControlTag) { case 41: { CButton con = new CButton(); con.DefaultBrush = new SolidColorBrush(Color.FromRgb(189, 195, 199)); con.Hover = new SolidColorBrush(Color.FromRgb(189, 195, 199)); con.ClickBrush = new SolidColorBrush(Color.FromRgb(189, 195, 199)); con.ChangeHover = false; con.OpacityHover = 0.8; con.ChangeClick = false; con.OpacityClick = 0.6; con.contentCreator.contents.Add(new Content_Text(Strings.ResStrings.Button, 20, 0)); con.Content = con.contentCreator.Create(data); con.Width = 150; con.Height = 50; Panel.SetZIndex(con, 10); con.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Canvas.SetLeft(con, p.X - con.DesiredSize.Width / 2); Canvas.SetTop(con, p.Y - con.DesiredSize.Height / 2); AddEvents(con); DesignCanvas.Children.Add(con); } break; case 42: { AnswerButton con = new AnswerButton(); Panel.SetZIndex(con, 5); con.Width = 250; con.Height = 60; con.contentCreator.contents.Add(new Content_Text(Strings.ResStrings.AnswerButton, 20, 0)); con.AnswerPanel.Children.Add(con.contentCreator.Create(data)); con.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Canvas.SetLeft(con, p.X - con.DesiredSize.Width / 2); Canvas.SetTop(con, p.Y - con.DesiredSize.Height / 2); AddEvents(con); DesignCanvas.Children.Add(con); } break; case 43: { TextBox textbox = new TextBox(); textbox.Text = Strings.ResStrings.EditBox; textbox.IsReadOnly = true; textbox.Width = 100; textbox.Height = 20; textbox.VerticalContentAlignment = VerticalAlignment.Center; textbox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); textbox.Focusable = false; Canvas.SetLeft(textbox, p.X - textbox.DesiredSize.Width / 2); Canvas.SetTop(textbox, p.Y - textbox.DesiredSize.Height / 2); AddEvents(textbox); DesignCanvas.Children.Add(textbox); } break; case 44: { CheckBox con = new CheckBox(); con.IsChecked = false; con.Width = 150; con.Height = 30; con.Content = Strings.ResStrings.Checkbox; con.Focusable = false; con.VerticalContentAlignment = VerticalAlignment.Center; Panel.SetZIndex(con, 2); con.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Canvas.SetLeft(con, p.X - con.DesiredSize.Width / 2); Canvas.SetTop(con, p.Y - con.DesiredSize.Height / 2); AddEvents(con); DesignCanvas.Children.Add(con); } break; case 45: { RadioButton con = new RadioButton(); con.Width = 150; con.Height = 30; con.Content = Strings.ResStrings.RadioButton; con.Focusable = false; con.GroupName = "1"; con.IsChecked = false; con.VerticalContentAlignment = VerticalAlignment.Center; Panel.SetZIndex(con, 2); con.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Canvas.SetLeft(con, p.X - con.DesiredSize.Width / 2); Canvas.SetTop(con, p.Y - con.DesiredSize.Height / 2); AddEvents(con); DesignCanvas.Children.Add(con); } break; case 46: { ComboBox_Control con = new ComboBox_Control(); con.Width = 190; con.Height = 40; con.combobox.VerticalContentAlignment = VerticalAlignment.Center; ContentCreator contentCreator = new ContentCreator(); contentCreator.contents.Add(new Content_Text(Strings.ResStrings.ComboBox, 16, 0)); con.contents.Add(contentCreator); con.Create(data); con.Focusable = false; Panel.SetZIndex(con, 2); con.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Canvas.SetLeft(con, p.X - con.DesiredSize.Width / 2); Canvas.SetTop(con, p.Y - con.DesiredSize.Height / 2); AddEvents(con); DesignCanvas.Children.Add(con); } break; case 47: { ToggleButton_Control con = new ToggleButton_Control(); con.Width = 150; con.Height = 50; con.contentCreatorUnchecked.contents.Add(new Content_Text(Strings.ResStrings.Off, 20, 10)); con.contentCreatorChecked.contents.Add(new Content_Text(Strings.ResStrings.On, 20, 10)); con.SetData(data); con.SetChecked(false, true); Panel.SetZIndex(con, 2); con.Ccontent.VerticalAlignment = VerticalAlignment.Center; con.Ccontent.HorizontalAlignment = HorizontalAlignment.Left; con.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); Canvas.SetLeft(con, p.X - con.DesiredSize.Width / 2); Canvas.SetTop(con, p.Y - con.DesiredSize.Height / 2); AddEvents(con); DesignCanvas.Children.Add(con); } break; } }