Exemplo n.º 1
0
 private void NewClick(object sender, RoutedEventArgs e)
 {
     if (MainCollection.IsSave || SaveDialog())
     {
         MainCollection = new V2MainCollection();
         Resources["MainCollection"] = MainCollection;
     }
 }
Exemplo n.º 2
0
 private void New_btn_Click(object sender, RoutedEventArgs e)
 {
     if (mainCollection.CollectionChangedAfterSave)
     {
         UnsavedChanges();
     }
     mainCollection = new V2MainCollection();
     DataContext    = mainCollection;
     MessageError();
 }
Exemplo n.º 3
0
    static void Main()
    {
        Grid1D G_1 = new Grid1D(3, 3);
        Grid1D G_2 = new Grid1D(5, 3);

        V2DataOnGrid V2_1 = new V2DataOnGrid("new_1", 5, G_1, G_2);

        V2_1.InitRandom(5, 10);
        //V2_1.NearAverage(0.9f);

        Console.WriteLine('\n' + V2_1.ToLongString());

        V2DataCollection V2C = (V2DataOnGrid)V2_1;

        Console.WriteLine('\n' + V2C.ToLongString());
        //V2C.NearAverage(0.9f);

        V2MainCollection VM_1 = new V2MainCollection();

        VM_1.AddDefaults();
        VM_1.ToString();

        Vector2 vect = new Vector2((float)101010, (float)111);

        foreach (var item in VM_1)
        {
            item.NearAverage(0.5f);
        }


        //Console.WriteLine(V2C.ToLongString());
        //Console.WriteLine(V2_1.NearAverage(0.5f));
        //Console.WriteLine(V2_1.ToString());
        //Console.WriteLine(V2_1.ToLongString());

        V2DataCollection V2C_1 = new V2DataCollection("newC_1", 6);
        V2DataCollection V2C_2 = new V2DataCollection("newC_2", 7);

        //V2C_1.InitRandom(10,10,10,-20,30);
        //Console.WriteLine(V2C_1.ToLongString());
        //V2C_1.NearAverage(0.9f);
        //Console.WriteLine(V2C_1.ToString());
        //Console.WriteLine(V2C_1.ToLongString());

        VM_1.Add(V2_1);
        VM_1.Add(V2C_1);
        VM_1.Add(V2C_2);
        //Console.WriteLine(VM_1.Count);
        VM_1.Remove("new_1", 5);
        //Console.WriteLine(VM_1.Count);
        //VM_1.AddDefaults();
        //Console.WriteLine(VM_1.Count);
    }
Exemplo n.º 4
0
 private void Open_btn_Click(object sender, RoutedEventArgs e)
 {
     if (mainCollection.CollectionChangedAfterSave)
     {
         UnsavedChanges();
     }
     Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
     if ((bool)dialog.ShowDialog())
     {
         mainCollection = new V2MainCollection();
         mainCollection.Load(dialog.FileName);
         DataContext = mainCollection;
     }
     MessageError();
 }
Exemplo n.º 5
0
        private void OpenClick(object sender, RoutedEventArgs e)
        {
            if (MainCollection.IsSave || SaveDialog())
            {
                OpenFileDialog OpenDialog = new OpenFileDialog {
                    Filter      = "Binary data|*.dat|All|*.*",
                    FilterIndex = 1
                };

                if (OpenDialog.ShowDialog() == true)
                {
                    MainCollection = new V2MainCollection();
                    MainCollection.Load(OpenDialog.FileName);
                    Resources["MainCollection"] = MainCollection;
                }
            }
        }
Exemplo n.º 6
0
        private void Remove_btn_Click(object sender, RoutedEventArgs e)
        {
            var selected = this.listBox_Main.SelectedItems;

            if (this.listBox_Main.SelectedItems.Count != 0)
            {
                List <V2Data> selectedItems = new List <V2Data>();
                selectedItems.AddRange(selected.Cast <V2Data>());
                foreach (V2Data item in selectedItems)
                {
                    mainCollection.Remove(item.Info, item.Freq);
                }
            }
            else
            {
                mainCollection = new V2MainCollection();
                DataContext    = mainCollection;
            }
        }
Exemplo n.º 7
0
 public MainWindow()
 {
     MainCollection = new V2MainCollection();
     InitializeComponent();
     Resources["MainCollection"] = MainCollection;
 }
Exemplo n.º 8
0
    static void Main()
    {
        Grid1D G_1 = new Grid1D(3, 3);
        Grid1D G_2 = new Grid1D(5, 3);

        V2DataOnGrid V2_1 = new V2DataOnGrid("new_1", 5, G_1, G_2);

        V2_1.InitRandom(5, 10);
        //V2_1.NearAverage(0.9f);

        Console.WriteLine('\n' + V2_1.ToLongString());

        V2DataCollection V2C = (V2DataOnGrid)V2_1;

        Console.WriteLine('\n' + V2C.ToLongString());
        //V2C.NearAverage(0.9f);

        V2MainCollection VM_1 = new V2MainCollection();

        VM_1.AddDefaults();
        VM_1.ToString();

        Vector2 vect = new Vector2((float)101010, (float)111);

        foreach (var item in VM_1)
        {
            item.NearAverage(0.5f);
        }


        //Console.WriteLine(V2C.ToLongString());
        //Console.WriteLine(V2_1.NearAverage(0.5f));
        //Console.WriteLine(V2_1.ToString());
        //Console.WriteLine(V2_1.ToLongString());

        V2DataCollection V2C_1 = new V2DataCollection("newC_1", 6);
        V2DataCollection V2C_2 = new V2DataCollection("newC_2", 7);

        //V2C_1.InitRandom(10,10,10,-20,30);
        //Console.WriteLine(V2C_1.ToLongString());
        //V2C_1.NearAverage(0.9f);
        //Console.WriteLine(V2C_1.ToString());
        //Console.WriteLine(V2C_1.ToLongString());

        VM_1.Add(V2_1);
        VM_1.Add(V2C_1);
        VM_1.Add(V2C_2);
        //Console.WriteLine(VM_1.Count);
        VM_1.Remove("new_1", 5);
        //Console.WriteLine(VM_1.Count);
        //VM_1.AddDefaults();
        //Console.WriteLine(VM_1.Count);


        V2DataCollection Lab_2_Data_Coll = new V2DataCollection("C:/Users/mrlyk/Desktop/Lab2/HomeTask/Лабораторная 2/Лаба/data.txt");

        Console.WriteLine(Lab_2_Data_Coll.ToLongString());

        V2MainCollection Lab_2_Main_Coll = new V2MainCollection();

        Lab_2_Main_Coll.AddDefaults();
        Console.WriteLine(Lab_2_Main_Coll.Mid_Value);
        Console.WriteLine(Lab_2_Main_Coll.Max_Far_Away);
        Console.WriteLine(Lab_2_Main_Coll.More_then_one);
    }