private void HandlePlaybackQueueCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (!PlaybackQueue.IsRootChanging) { if (e.Action == NotifyCollectionChangedAction.Remove) { oldIndex = e.OldStartingIndex; } else if (e.Action == NotifyCollectionChangedAction.Add) { int newIndex = e.NewStartingIndex; PlaybackQueue.IsEndChanging = true; rootModel.MoveSong(oldIndex, newIndex); PlaybackQueue.IsEndChanging = false; } } else { if (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Replace) { foreach (PlayQueueEntryViewModel model in e.OldItems) { LookupDictionary.Remove(model.RowId); } } if (e.Action == NotifyCollectionChangedAction.Add || e.Action == NotifyCollectionChangedAction.Replace) { foreach (PlayQueueEntryViewModel model in e.NewItems) { LookupDictionary.Add(model.RowId, model); } } if (e.Action == NotifyCollectionChangedAction.Reset) { LookupDictionary.Clear(); } PlayPausePlayer.RaiseExecuteChanged(); ShuffleRemaining.RaiseExecuteChanged(); NotifyPropertyChanged(Properties.IsEmpty); } int currentPosition = 1; foreach (PlayQueueEntryViewModel model in PlaybackQueue) { model.TotalPosition = currentPosition; currentPosition++; } NotifyPropertyChanged(Properties.NextTrack); NotifyPropertyChanged(Properties.PrevTrack); NotifyPropertyChanged(Properties.TracksLeft); ClearPlayed.RaiseExecuteChanged(); ClearAll.RaiseExecuteChanged(); }
private async Task RunAsync() { await foreach (var item in _channel.Reader.ReadAllAsync()) { switch (item) { case ToggleImage image: if (ToggleImage is not null) { await ToggleImage.Invoke(image); } break; case PlaySound sound: if (PlaySound is not null) { await PlaySound.Invoke(sound); } break; case Services.ClearAll: if (ClearAll is not null) { await ClearAll.Invoke(); } break; } } }
private void Equal_Click(object sender, EventArgs e) { switch (operator_icon) { case "+": { result.Text = (ResultVal + double.Parse(result.Text)).ToString(); break; } case "-": { result.Text = (ResultVal - double.Parse(result.Text)).ToString(); break; } case "X": { result.Text = (ResultVal * double.Parse(result.Text)).ToString(); break; } case "/": { try { if (result.Text == "0") { ResultVal /= 0; } result.Text = ((ResultVal) / double.Parse(result.Text)).ToString(); } catch { //Insert code here } result.Text = ((ResultVal) / double.Parse(result.Text)).ToString(); break; } default: break; } ResultVal = double.Parse(result.Text); CurrentOperator.Text = ""; isDigitalPressed = false; if (isDigitalPressed == true) { ClearAll.PerformClick(); } }
public void LoadButtonClick() { try { string path = EditorUtility.OpenFilePanel("Opening file", "Assets/Saves", "txt"); using (StreamReader sr = File.OpenText(path)) { ClearAll.RemoveAll(); string curr = sr.ReadLine(); curr = sr.ReadLine(); int y = 0; int pcount; int ecount; pcount = (int)getNumber(curr, ref y); curr = sr.ReadLine(); y = 0; ecount = (int)getNumber(curr, ref y); for (int i = 1; i <= pcount; i++) { int p = 0; curr = sr.ReadLine(); float vx = getNumber(curr, ref p); p++; float vy = getNumber(curr, ref p); p++; float vz = getNumber(curr, ref p); Vector3 pos = new Vector3(vx, vy, vz); GameObject currobj = (GameObject)Instantiate(instance, pos, Quaternion.identity); Transform currt = currobj.GetComponent <Transform> (); currt.position = pos; Point current = new Point(pos, currobj); } for (int i = 1; i <= ecount; i++) { curr = sr.ReadLine(); int p = 0; int start = (int)getNumber(curr, ref p); p++; int end = (int)getNumber(curr, ref p); p++; int weight = (int)getNumber(curr, ref p); p++; int orientation = curr[p] - '0'; GameObject cylinder; if (orientation == 0) { cylinder = (GameObject)Instantiate(edgeInstance, Vector3.zero, Quaternion.identity); } else { cylinder = (GameObject)Instantiate(orientedInstance, Vector3.zero, Quaternion.identity); } Edge current; if (orientation == 0) { current = new Edge(start, end, weight, cylinder, i); } else { current = new Edge(start, end, weight, cylinder, i, true); } Edge.edges [i] = current; if (Point.Points[start].connected == null) { Point.Points[start].connected = new List <Edge>(); } if (orientation == 0) { if (Point.Points[end].connected == null) { Point.Points[end].connected = new List <Edge>(); } } Point.Points[start].connected.Add(current); if (orientation == 0) { Point.Points[end].connected.Add(current); } EdgeCreate.InitializeEdge(Point.Points[start].body, Point.Points[end].body, cylinder, current.label); } Edge.edgeCount = ecount; Point.pointCount = pcount; } } catch (System.Exception k) { Debug.Log(k.Message); } }
private void Clear_Click(object sender, RoutedEventArgs e) { ClearAll.Invoke(sender, e); }
public static void DataFromFile() { ClearAll.FuncClearALL(); NameFile = "name.txt"; DataFile = File.ReadAllLines(NameFile); Debug.Log(DataFile[0]); for (int i = 1; i < DataFile.Length; i++) { String value = DataFile[i]; String[] vaslues = value.Split(new char[] { '\t', ' ', '|', '[', ']' }, StringSplitOptions.RemoveEmptyEntries); for (int j = 0; j < vaslues.Length; j++) { switch (valueNames[j]) { case "X1": if (valueNames[j].Contains(mines)) { Params.X1.Add(-1 * Convert.ToDouble(vaslues[j])); } else { Params.X1.Add(Convert.ToDouble(vaslues[j])); } break; case "Y1": if (valueNames[j].Contains(mines)) { Params.Y1.Add(-1 * Convert.ToDouble(vaslues[j])); } else { Params.Y1.Add(Convert.ToDouble(vaslues[j])); } break; case "X2": if (valueNames[j].Contains(mines)) { Params.X2.Add(-1 * Convert.ToDouble(vaslues[j])); } else { Params.X2.Add(Convert.ToDouble(vaslues[j])); } break; case "Y2": if (valueNames[j].Contains(mines)) { Params.Y2.Add(-1 * Convert.ToDouble(vaslues[j])); } else { Params.Y2.Add(Convert.ToDouble(vaslues[j])); } break; } } } // Debug.Log(Params.X1.ToArray()[0] + " " + (Params.Y1.ToArray()[0]) + " " + Params.X2.ToArray()[0] +" "+ (Params.Y2.ToArray()[0])); bild = true; }
public void ClearAllBtn() { ClearAll.FuncClearALL(); }