示例#1
0
        public static void Main()
        {
            CommonFunc.IntialUniqleString();

            if (SingleInstance <App> .InitializeAsFirstInstance(GlobalVar._uniqueStr))
            {
                var application = new App();
                application.InitializeComponent();
                application.Run();

                SingleInstance <App> .Cleanup();
            }
        }
示例#2
0
        private void page_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            click_count++;

            if (click_count == Parameter.debug_on_click)
            {
                GlobalVar._debugmode = !GlobalVar._debugmode;
                RefreshDebugInfoVisibility();
                CommonFunc.ToastMessage(label_message,
                                        String.Format("Debug mode is {0}!", GlobalVar._debugmode ? "ON" : "OFF"),
                                        2);
                click_count = 0;
            }
        }
示例#3
0
        private bool CheckKeyFileAvailable()
        {
            string keyFile = CommonFunc.GetKeyfilePath();

            if (!File.Exists(keyFile))
            {
                if (!CheckAuthentication())
                {
                    MessageBox.Show("Authentication failed!");
                    return(false);
                }
            }

            return(true);
        }
示例#4
0
        private bool LoadResource()
        {
            if (!CheckKeyFileAvailable())
            {
                return(false);
            }

            if (!CommonFunc.RunWithProcessingUC(
                    new OperationHandlerWithResult(CheckbinAvailable),
                    "Initialing..."))
            {
                return(false);
            }

            return(true);
        }
示例#5
0
        private void AutoFillInDatePicker()
        {
            DateTime currenttime = CommonFunc.GetZoneTime(GlobalVar._timezoneId);
            DateTime date        = CommonFunc.SetZoneTime(GlobalVar._timezoneId,
                                                          currenttime.Date,
                                                          Convert.ToInt32(tb_starttime_hour.Text),
                                                          Convert.ToInt32(tb_starttime_min.Text));

            if (IsPreviousTime(date, currenttime))
            {
                datepicker_startdate.SelectedDate = date.AddDays(1).Date;
            }
            else
            {
                datepicker_startdate.SelectedDate = date.Date;
            }
        }
示例#6
0
        private DateTime GetStartTime()
        {
            DateTime date;

            if (rb_starttime_now.IsChecked == true)
            {
                date = temp_currenttime.AddSeconds(Parameter.delay_sec);
            }
            else
            {
                date = CommonFunc.SetZoneTime(GlobalVar._timezoneId,
                                              datepicker_startdate.SelectedDate.Value.Date,
                                              Convert.ToInt32(tb_starttime_hour.Text),
                                              Convert.ToInt32(tb_starttime_min.Text));
            }

            return(date);
        }
示例#7
0
        private void RefreshDataGrid()
        {
            //Debug.WriteLine("Refresh DataGrid at " + DateTime.Now.ToString("HH:mm:ss"));

            if (CommonFunc.GetStatusChangedFlag())
            {
                CommonFunc.ClearStatusChangedFlag();

                if (chechbox_isshutdown.IsChecked == true &&
                    chechbox_isshutdown.Visibility == Visibility.Visible &&
                    IsAllSceduleCompleted())
                {
                    StopRefreshDataGrid();
                    if (!CommonFunc.PrepareShutDown(this))
                    {
                        chechbox_isshutdown.IsChecked = false;
                        StartRefreshDataGrid();
                    }
                }
            }
        }
示例#8
0
        private DateTime GetEndTime()
        {
            DateTime date;

            if (rb_set_endtime.IsChecked == true)
            {
                date = CommonFunc.SetZoneTime(GlobalVar._timezoneId,
                                              datepicker_startdate.SelectedDate.Value.Date,
                                              Convert.ToInt32(tb_endtime_hour.Text),
                                              Convert.ToInt32(tb_endtime_min.Text));

                if (IsPreviousTime(date, temp_starttime))
                {
                    date = date.AddDays(1);
                }
            }
            else
            {
                date = temp_starttime.AddSeconds(CalculateDuration2sec());
            }

            return(date);
        }
示例#9
0
 private void InitailEndTime()
 {
     tb_endtime_hour.Text = CommonFunc.GetZoneTime(GlobalVar._timezoneId).AddHours(1).Hour.ToString("00");
     tb_endtime_min.Text  = CommonFunc.GetZoneTime(GlobalVar._timezoneId).Minute.ToString("00");
 }
示例#10
0
 private void btn_test_Click(object sender, RoutedEventArgs e)
 {
     CommonFunc.test();
 }
示例#11
0
 private void btn_updateM3U8_Click(object sender, RoutedEventArgs e)
 {
     CommonFunc.RunWithProcessingUC(new OperationHandlerWithResult(CommonFunc.DownloadM3U8), "Downloading fils...");
 }
示例#12
0
 private void UpdateClock()
 {
     label_timezone.Content = "UTC " + CommonFunc.GetTimeZoneHour(GlobalVar._timezoneId);
     grid_clock.ToolTip     = CommonFunc.GetTimeZoneDisplayName(GlobalVar._timezoneId);
 }
示例#13
0
        private void InitialCommonFunc()
        {
            CommonFunc func = new CommonFunc();

            func.window = this;
        }