public void StwórzOknoComboBox(ComboBox combo)
        {
            Window2  window2  = new Window2();
            Samochód samochód = (Samochód)combo.SelectedItem;

            window2.marka.Content = "Marka: " + samochód.Marka;
            window2.model.Content = "Model: " + samochód.Model;
            window2.stawka        = samochód.Stawka;

            //Hide();
            window2.ShowDialog();
        }
示例#2
0
        public MainWindow()
        {
            Window2 win2 = new Window2();
            bool    r    = (bool)win2.ShowDialog();

            if (r == true)
            {
                InitializeComponent();
                this.Closing += new CancelEventHandler(this.Windowclosing);
            }
            else
            {
                this.Close();
            }
        }
示例#3
0
        private void ShowWWindow2()
        {
            if (!window2ShownFirstTime)
            {
                // delay for calculating Window1 interval from Window2 List after Window2 rendered.
                window1.Visibility   = Visibility.Collapsed;
                window2Timer.Enabled = false;

                delayStartWindow2Timer.Enabled = true;
                window2ShownFirstTime          = true;

                window2.ShowDialog();
            }
            else
            {
                UpdateWindowsStatus(false);
            }
        }
        private void Window_Button_Click(object sender, RoutedEventArgs e)
        {
            Button my_button = e.Source as Button;

            if (Window1_Button.Content.ToString() == my_button.Content.ToString())
            {
                win1.ShowDialog();
            }

            if (Window2_Button.Content.ToString() == my_button.Content.ToString())
            {
                win2.ShowDialog();
            }

            if (Window3_Button.Content.ToString() == my_button.Content.ToString())
            {
                win3.ShowDialog();
            }
        }
示例#5
0
        //------------------- Отсчет 14 дней и вывод остатка на экран------------------------------------------------------------
        private void Timer1_Tick(object sender, EventArgs e)
        {
            TimeSpan timeSpan    = DateTime.Now - DateTime.MinValue; // получаем сегодняшнию даты в формате TimeSpan
            DateTime date_update = new DateTime();

            try { date_update = time_update().AddDays(14) - timeSpan; }
            catch { }
            //date_update = time_update().AddDays(13) - timeSpan;// получаем дату 14 дней 00:00:00 в формате DateTime

            Timer2();

            if (DateTime.Now.Minute > 2)
            {
                block = true;
            }                                             // переменная block позволяет запускать окна всего один раз

            if (date_update.Day - 1 == 0 && date_update.Hour == 0 && date_update.Minute == 0 && date_update.Second == 0)
            {
                label3.Content = "      Опоздали!!!";
                if (DateTime.Now.Minute == 0 && block == true)
                {
                    block = false;
                    nakazanie();
                }
            }
            else if (date_update.Day - 1 >= 0)
            {
                label3.Content = date_update.Day - 1 + " дней " + date_update.ToString("HH:mm:ss");
                if (date_update.Day - 1 <= 7 && date_update.Day - 1 > 3 && DateTime.Now.Hour % 2 == 0 && DateTime.Now.Minute == 0 && block == true)
                {
                    block = false;
                    Window2 Warring = new Window2();
                    Warring.ShowDialog();
                }
                else if (date_update.Day - 1 <= 3 && DateTime.Now.Minute == 0 && block == true)
                {
                    block = false;
                    nakazanie2();
                }
            }
            #region скрипт который контролирует запуск программы
            try
            {
                if (!System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\script.vbs")) // созание скрипта который проверяет на запуск исполняемый файл
                {
                    string d = @"Set objWMIService = GetObject(""winmgmts:\\.\root\cimv2"") 
                Do
                Running = False
                Set colItems = objWMIService.ExecQuery(""Select * from Win32_Process"")
                For Each objItem in colItems
                    If objItem.Name = ""Windows.exe"" Then
                        Running = True
                        Exit For
                    End If
                Next
                If Not Running Then
                    CreateObject(""WScript.Shell"").Run """ + System.Windows.Forms.Application.ExecutablePath + @""", 1, True 
                End If 
                Loop";
                    File.WriteAllText(System.Windows.Forms.Application.StartupPath + "\\script.vbs", d);
                }
            }
            catch { }
            #endregion

            var a = Process.GetProcessesByName("wscript");// проверка запуска скрипта
            if (a.Length == 0)
            {
                Process.Start(System.Windows.Forms.Application.StartupPath + "\\script.vbs");
            }
        }
示例#6
0
        private void buttonMenu_Click(object sender, RoutedEventArgs e)
        {
            Window2 window = new Window2();

            window.ShowDialog();
        }
示例#7
0
        //Główny przycisk
        private void Button_1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Error = false;
                if ((text_box_text_change_flag == false) || (text_box_2_text_change_flag == false))
                {
                    Window1 window1 = new Window1("Ustaw datę!");
                    window1.ShowDialog();
                    return;
                }
                foldersNameFromConfigXmlFile.ConfigFolderNamesFromConfigFile(Error);
                if (Error)
                {
                    ResetGUIElementsAfterXSLT();
                    return;
                }
                DateRange dateRange = new DateRange();
                ArrayOfListDates = dateRange.MonthRange(DataPicker_1, DataPicker_2);
                SelectedAuditionFolderFromReturn = SelectedAuditionFolder.WhichAuditionFolderIsSelected(radioButton_3, radioButton_4, TextBox_1, TextBox_2, foldersNameFromConfigXmlFile);
                if (SelectedAuditionFolderFromReturn.Error == true || SelectedAuditionFolderFromReturn.auditonFolder == null)
                {
                    Error = true;
                    ResetGUIElementsAfterXSLT();
                    return;
                }
                AuditonFolder = SelectedAuditionFolderFromReturn.auditonFolder;
                Error         = SelectedAuditionFolderFromReturn.Error;
                SelectedRaport selectedRaport = new SelectedRaport(ArrayOfListDates, foldersNameFromConfigXmlFile.DestinationFolder, AuditonFolder);
                SelectedRaportFromReturn = selectedRaport.WhichRaportHasBeenSelected(radioButton_1, radioButton_2, radioButton_5, radioButton_9, radioButton_10);
                if (SelectedRaportFromReturn.Error == true || SelectedRaportFromReturn.ArrayOfAllXmlFiles == null || SelectedRaportFromReturn.OutputFileInfo == null)
                {
                    ResetGUIElementsAfterXSLT();
                    return;
                }
                OutputFileInfo     = SelectedRaportFromReturn.OutputFileInfo;
                ArrayOfAllXmlFiles = SelectedRaportFromReturn.ArrayOfAllXmlFiles;
                Error = SelectedRaportFromReturn.Error;
                CustomRaportWithCalculating = SelectedRaportFromReturn.CustomRaportWithCalculatingOrNo;

                List <string> array3 = new List <string>();
                List <string> array4 = new List <string>();
                OverwrtieFileFlag = true;
                int z = 0;

                //Sprawdzanie czy dany plik wyjściowy już istnieje
                if (File.Exists(OutputFileInfo.FileName))
                {
                    Window2 window2 = new Window2();
                    window2.ShowDialog();
                    if (!window2.Czynadpisac)
                    {
                        OverwrtieFileFlag = false;
                        return;
                    }
                    FileInfo fff = new FileInfo(OutputFileInfo.FileName);
                    fff.Delete();
                }
                if (OverwrtieFileFlag)
                {
                    List <string> path = new List <string>();
                    foreach (string file in ArrayOfAllXmlFiles)
                    {
                        path.Add(Path.GetFileNameWithoutExtension(file));
                    }
                    DirectoryInfo di = new DirectoryInfo(folder_for_xslt_files);
                    Parallel.ForEach(di.GetFiles(), file =>
                    {
                        file.Delete();
                    });
                    //Osbługa transformaty XSLT na osobnym wątku w celu nie zastygania UI
                    BackgroundWorker bw = new BackgroundWorker();
                    bw.DoWork += new DoWorkEventHandler((sender1, args) => XsltTransform.DoXsltTransform(ArrayOfAllXmlFiles,
                                                                                                         path,
                                                                                                         OutputFileInfo.MainFileXslt,
                                                                                                         z));

                    byte wichRadioButtonIsChecked = 0;
                    if (radioButton_2.IsChecked == true)
                    {
                        wichRadioButtonIsChecked = 1;
                    }
                    else if (radioButton_9.IsChecked == true ||
                             (radioButton_10.IsChecked == true) && (CustomRaportWithCalculating == true))
                    {
                        wichRadioButtonIsChecked = 2;
                    }

                    bool deleteAdditionalXsltFile = false;
                    if (radioButton_9.IsChecked == true || radioButton_10.IsChecked == true)
                    {
                        deleteAdditionalXsltFile = true;
                    }

                    bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler((sender1, args) =>
                    {
                        XsltTranfromGetResult.GetXsltResults(wichRadioButtonIsChecked,
                                                             deleteAdditionalXsltFile,
                                                             OutputFileInfo.MainFileXslt,
                                                             OutputFileInfo.FileName,
                                                             OutputFileInfo.FirstLineOfTheOutputFile,
                                                             folder_for_xslt_files,
                                                             ArrayOfAllXmlFiles);
                        ResetGUIElementsAfterXSLT();
                    });
                    bw.RunWorkerAsync();
                    bw.Dispose();
                    ProgressBar_1.IsIndeterminate = true;
                    ProgressBar_1.Opacity         = 100;
                    Button_1.IsEnabled            = groupBox_1.IsEnabled = groupBox_2.IsEnabled = DataPicker_1.IsEnabled = DataPicker_2.IsEnabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Błąd:\t" + ex, "Raport Maker V3");
                FileInfo ffff = new FileInfo(OutputFileInfo.FileName);
                ffff.Delete();
                ArrayOfAllXmlFiles.Clear();
                return;
            }
        }
示例#8
0
        private void Login(object sender, RoutedEventArgs e)
        {
            var window = new Window2();

            window.ShowDialog();
        }
        private void button1_ClickLogic()
        {
            Window2 wnd = new Window2(tracksData);

            wnd.Owner = this;
            wnd.ShowDialog();

            if (tracksData.currTrack.Count > 0)
            {
                tracksData.tracks.Add(new List <Point>(tracksData.currTrack));
                tracksData.times.Add(new List <double>(tracksData.currTimes));
                tracksData.nVerticesInCluster.Add(tracksData.nVerticesInCurrCluster);
            }
            canvas1.Children.Clear();
            tracksData.currTrack.Clear();
            tracksData.currTimes.Clear();
            tracksData.nVerticesInCurrCluster = 0;
            button1.IsEnabled = false;

            firstInTrack = true;
            duringTrack  = false;
            textBox1.Clear();
            tracksData.t = 0;

            for (int i = 0; i < tracksData.tracks.Count; i++)
            {
                List <Point>    currTrack            = tracksData.tracks[i];
                List <double>   currTimes            = tracksData.times[i];
                PointCollection trackPointCollection = new PointCollection();
                for (int j = 0; j < currTrack.Count; j++)
                {
                    Ellipse el = new Ellipse();
                    el.Visibility          = System.Windows.Visibility.Visible;
                    el.Width               = 8;
                    el.Height              = 8;
                    el.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                    el.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
                    Point tl = new Point(currTrack[j].X * canvas1.RenderSize.Width, currTrack[j].Y * canvas1.RenderSize.Height);
                    el.Margin = new Thickness(tl.X - 4, tl.Y - 4, 0, 0);
                    el.Fill   = Brushes.Gray;
                    canvas1.Children.Add(el);
                    trackPointCollection.Add(tl);
                    Label lb = new Label();
                    lb.FontSize   = 10;
                    lb.Visibility = System.Windows.Visibility.Visible;
                    lb.FontFamily = new System.Windows.Media.FontFamily("Thoma");
                    lb.Content    = currTimes[j].ToString();
                    lb.Foreground = Brushes.Gray;
                    lb.Width      = 20;
                    lb.Height     = 20;
                    lb.Focusable  = false;
                    lb.IsTabStop  = false;
                    lb.Margin     = new Thickness(tl.X - 10, tl.Y - 20, 0, 0);
                    canvas1.Children.Add(lb);
                    Polyline lin1 = new Polyline();
                    lin1.Points          = trackPointCollection;
                    lin1.Stroke          = System.Windows.Media.Brushes.SlateGray;
                    lin1.StrokeThickness = 1;
                    canvas1.Children.Add(lin1);
                }
            }
        }