Esempio n. 1
0
        public void Open(FarsiLibrary.Win.FATabStrip faTabStripMain, string path="")
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                if (string.IsNullOrEmpty(path))
                {
                    ofd.Filter = "PList(*.plist)|*.plist|All files|*.*";
                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        path = ofd.FileName;
                    }
                }
                if (!string.IsNullOrEmpty(path))
                {
                    try
                    {
                        PlistInfo p = new PlistInfo(path);
                        bool suc = p.Read();
                        CreateTab(faTabStripMain, p.Info.Name, p);

                        if (!suc)
                        {
                            MessageBox.Show("Xml format error");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        Debug.WriteLine(ex);
                    }
                }
            }
        }
Esempio n. 2
0
 private void faDatePicker1_SelectedDateTimeChanging(object sender, FarsiLibrary.Win.Events.SelectedDateTimeChangingEventArgs e)
 {
     if (!faDatePicker1.IsNull && e.NewValue.Value.Year > 2000)
     {
         e.Message = "This is a custom error message.";
     }
 }
Esempio n. 3
0
 public void CloseTab(FarsiLibrary.Win.FATabStripItem tab)
 {
     tabstrip.RemoveTab(tab);
       if (0 == tabstrip.Items.Count)
       {
     CreateNewTab();
       }
 }
Esempio n. 4
0
        private void faDatePickerConverter1_SelectedDateTimeChanging(object sender, FarsiLibrary.Win.Events.SelectedDateTimeChangingEventArgs e)
        {
            PersianDate pd = e.NewValue;

            if(pd.Day != 8 || pd.Month != 4 || pd.Year != 1385)
            {
                e.Cancel = true;
            }
        }
Esempio n. 5
0
        public sefaresh(string table, string fish, FarsiLibrary.Utils.PersianDate time, ArrayList food_list)
        {
            table_fishcode = fish;
            table_number = table;
            this.time = time;
            list_codecstring = food_list;
            list_sefareshshow = convert_codeclist_to_sefareshlist(this);

            get_total_cost();
        }
Esempio n. 6
0
        public sefaresh(string table, string fish, FarsiLibrary.Utils.PersianDate time, List<sefaresh_show> sefaresh_show_list, bool a)
        {
            table_fishcode = fish;
            table_number = table;
            this.time = time;

            list_codecstring = null;
            list_sefareshshow = sefaresh_show_list;

            get_total_cost();
        }
Esempio n. 7
0
 private void faDatePicker2_SelectedDateTimeChanging(object sender, FarsiLibrary.Win.Events.SelectedDateTimeChangingEventArgs e)
 {
     if (!faDatePicker2.IsNull)
     {
         PersianDate pd = e.NewValue.Value;
         if (pd.Day != 20)
         {
             e.Message = "Invalid date. Default Date is applied.";
             e.NewValue = new DateTime(2010, 1, 20, 0, 0, 0);
         }
     }
 }
Esempio n. 8
0
 public void CreateNew(FarsiLibrary.Win.FATabStrip tabStrip)
 {
     string title = Res.NewPListTitle;
     PlistEditControl c = CreateTab(tabStrip, title);
     c.Editor.Text = Res.NewPListContent;
 }
Esempio n. 9
0
 private PlistEditControl CreateTab(FarsiLibrary.Win.FATabStrip tabStrip, string title, PlistInfo p = null)
 {
     PlistEditControl c = new PlistEditControl(tabStrip, title, p);
     if (controls.Count == 0 || p!=null)
     {
         curEditor = c;
         tabStrip.SelectedItem = c.Tab;
     }
     c.Tab.ContextMenuStrip = ((FormMain)main).contextMenuStripTab;
     controls.Add(c.Tab, c);
     Drop.Bind(c.Tab);
     return c;
 }
        private void faMonthView_DrawCurrentDay(object sender, FarsiLibrary.Win.Events.CustomDrawDayEventArgs e)
        {
            e.Handled = true;
            DateTime selectedDate = faMonthView.SelectedDateTime;
            DateTime eDate = PersianDateConverter.ToGregorianDateTime(new PersianDate(e.Year, e.Month, e.Day));
            string dayNo = toFarsi.Convert(e.Day.ToString());
            bool isAyyam = false;

            Holiday hd = new Holiday();
            hd.Date = eDate.Date;
            Holiday memHoliday = DataLayer.HasHoliday(hd);

            //see if e is public Holiday : color it and return
            string title;
            if ((title = Methods.ayyam(eDate)) != "")
            {
                isAyyam = true;
                if (test && selectedDate.Date == eDate.Date)
                {
                    lblHolidayTitle.Text = title;
                    //test = false;
                }
            }

            //see if is clicked to add or remove from holidays
            if (test && selectedDate.Date == eDate.Date)
            {
                if (memHoliday != null)
                {
                    Visit[] vis = DataLayer.HasHolidayVisit(memHoliday);
                    if (vis.Count() == 0 || Methods.ShowStandardMsgBox(FormMessageType.Question, "اخطار", "در این روز ویزیت تعریف شده است. آیا مایلید این روز تعطیل شود؟") == DialogResult.Yes)
                    {
                        DataLayer.Remove(memHoliday);
                        memHoliday = null;
                    }
                }
                else
                {
                    DataLayer.Insert(hd);
                    memHoliday = hd;
                }

                test = false;
            }

            //paint the calender depend on its holiday or not
            if (memHoliday != null)
            {
                using (LinearGradientBrush br2 = new LinearGradientBrush(e.Rectangle, Color.Red, Color.RosyBrown, 45, true))
                {
                    e.Graphics.FillRectangle(br2, e.Rectangle);
                    e.Graphics.DrawString(dayNo, font, holidayBrush, e.Rectangle, fmt);
                }
            }
            else if (!isAyyam)
            {
                using (LinearGradientBrush br2 = new LinearGradientBrush(e.Rectangle, Color.White, Color.White, 45, true))
                {
                    e.Graphics.FillRectangle(br2, e.Rectangle);
                    e.Graphics.DrawString(dayNo, font, normalBrush, e.Rectangle, fmt);
                }
            }
            else if (isAyyam)
            {
                using (LinearGradientBrush br2 = new LinearGradientBrush(e.Rectangle, Color.MediumSpringGreen, Color.RosyBrown, 45, true))
                {
                    e.Graphics.FillRectangle(br2, e.Rectangle);
                    e.Graphics.DrawString(dayNo, font, holidayBrush, e.Rectangle, fmt);
                }
            }
        }
 private void faMonthView_ButtonClicked(object sender, FarsiLibrary.Win.Events.CalendarButtonClickedEventArgs e)
 {
     test = e.Button == FAMonthViewButtons.MonthDay;
     lblHolidayTitle.Text = "";
 }
Esempio n. 12
0
 private void tabstrip_TabStripItemClosing(FarsiLibrary.Win.TabStripItemClosingEventArgs e)
 {
     e.Item.Controls.OfType<ApplicationWrapper>().ToList().ForEach((app) => app.Detach());
 }